I'm new to kendoUI.
I found the odata definition in kendo.data.odata.js, here's the code snippet:
The common way to use odata I see in this forum is like this:
The pre-defined callback funtion will be invoked by kendo framework automatically, but I want to do some extra things in this pre-defined callback. When I try to use it another way(as follows), it seems it does NOT work, perhaps kendo framework don't allow user to use $.ajax() manually.
But I use a tricky way, it will take another server call and looks ugly somehow, here's the code snippet:
I need to use odata type, is there some better solution? Any help will be with great appreciation.
I found the odata definition in kendo.data.odata.js, here's the code snippet:
........$.extend(true, kendo.data, { schemas: { odata: { type: "json", data: "d.results", total: "d.__count" } }, transports: { odata: { read: { cache: true, // to prevent jQuery from adding cache buster dataType: "jsonp", jsonpCallback: "callback", //required by OData jsonp: false // to prevent jQuery from adding the jsonpCallback in the query string - we will add it ourselves },.......var data = new kendo.data.DataSource({ type: "odata", transport: { }});......
type: "odata",serverFiltering: true,transport:{ read: function(options){ $.ajax({ //!!won't work when type is odata url:"http://my_test_url", dataType:"json", data:options.data, success:function (result) { options.success(result); doUserDefinedCallback(); //do my callback } }); } }
...... ....... type: "odata", //using odataserverFiltering: true,transport: { read: { //can NOT using $.ajax() manually here
url:"http://my_test_url" }},schema:{ data: function(response){ doServerCallFirst_Then_DoUserDefinedCallback(); //actually I do another server call here, then do my callback when the call returns.
return response.d.results; }}.......