Hi, i can´t get this to work when I don´t use batch=true.
This works for batch creation (i copied it from one of your examples), please notice the marked as bold and italic code:
var dataSource = new kendo.data.DataSource({ transport: { read: function(options) { /* implementation omitted for brevity */ }, create: function(options) { // make JSONP request to http://demos.telerik.com/kendo-ui/service/products/create $.ajax({ dataType: "jsonp", // "jsonp" is required for cross-domain requests; use "json" for same-domain requests // send the created data items as the "models" service parameter encoded in JSON data: { models: kendo.stringify(options.data.models) }, success: function(result) { // result is an array containing the recently created item
options.success(result); }, error: function(result) { // notify the data source that the request failed options.error(result); } }); } }, batch: true, schema: { model: { id: "ProductID" } }
I guess the only difference should be:
var dataSource = new kendo.data.DataSource({ transport: { read: function(options) { /* implementation omitted for brevity */ }, create: function(options) { // make JSONP request to http://demos.telerik.com/kendo-ui/service/products/create $.ajax({ dataType: "jsonp", // "jsonp" is required for cross-domain requests; use "json" for same-domain requests // send the created data items as the "models" service parameter encoded in JSON data: {//Send a single object array, the webservice is expecting an array of objects, i first coded it so it would work mainly with batch=true models: kendo.stringify([options.data]) }, success: function(result) { //result is an array of objects. contains the recently created item options.success(result); }, error: function(result) { // notify the data source that the request failed options.error(result); } }); } }, batch: false, schema: { model: { id: "ProductID" } }
I tried sending and receiving an object instead an array of objects, but it didnt work either...
Thanks a lot for your help.