Kendo Datasource Transport custom function not getting called -


im experiencing rather annoying bug (?) in kendo ui datasource.

my update method on transport not getting called when pass custom function, work if give url.

this works:

... transport: {    update: { url: "/my/action" } } ... 

this not

... transport: {    update: function(options) {       var params = json.stringify({             pageid: pageid,             pageitem: options.data       });       alert("update");       $.ajax({             url: "/my/action",             data:params,             success:function(result) {                 options.success($.isarray(result) ? result : [result]);             }       });    } } ... 

the function not getting invoked, ajax request made current page url, , model data being posted, rather odd. sounds bug me.

the reason have need this, because kendo can't figure out update action returns single element, , not array - so, since dont want bend api satisfy kendo, though i'd other way around.

have experienced this, , can point me in right direction?

i tried using schema.parse, didn't invoked when update method being called.

i use myds.sync() sync datasource.

works expected demo documentation:

var datasource = new kendo.data.datasource({     transport: {       read: function(options) {         $.ajax( {           url: "http://demos.kendoui.com/service/products",           datatype: "jsonp",           success: function(result) {             options.success(result);           }         });        },       update: function(options) {         alert(1);         // make jsonp request http://demos.kendoui.com/service/products/update          $.ajax( {           url: "http://demos.kendoui.com/service/products/update",           datatype: "jsonp", // "jsonp" required cross-domain requests; use "json" same-domain requests           // send updated data items "models" service parameter encoded in json           data: {             models: kendo.stringify(options.data.models)           },           success: function(result) {             // notify data source request succeeded              options.success(result);           },           error: function(result) {             // notify data source request failed             options.error(result);           }         });       }     },     batch: true,     schema: {       model: { id: "productid" }     }   });    datasource.fetch(function() {     var product = datasource.at(0);     product.set("unitprice", product.unitprice + 1);             datasource.sync();   }); 

here live demo: http://jsbin.com/omomes/1/edit


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -