Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dataSource = new DevExpress.data.CustomStore({
- key: "ID",
- load: function (loadOptions) {
- var deferred = $.Deferred(),
- args = {};
- if (loadOptions.sort) {
- args.orderby = loadOptions.sort[0].selector;
- if (loadOptions.sort[0].desc)
- args.orderby += " desc";
- }
- args.skip = loadOptions.skip || 0;
- args.take = loadOptions.take || 12;
- $.ajax({
- url: "{{ url("api/get/Ms_Country") }}",
- data: args,
- success: function(response) {
- console.log(response);
- deferred.resolve(response.data, { totalCount: response.totalCount });
- },
- error: function() {
- deferred.reject("Data Loading Error");
- },
- timeout: 5000
- });
- return deferred.promise();
- },
- insert : function(values){
- return $.ajax({
- url : "{{ url("api/store/Ms_Country") }}",
- method : 'POST',
- data : values
- });
- },
- remove : function(key) {
- return $.ajax({
- url: "{{ url("api/destroy/Ms_Country/") }}" + encodeURIComponent(key),
- method: "DELETE",
- })
- },
- update : function(key, values) {
- console.log(key);
- console.log(values);
- return $.ajax({
- url: "{{ url("api/update/Ms_Country/") }}" + encodeURIComponent(key),
- method: "POST",
- data: values
- })
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement