javascript - Getting a string on an update request in KendoUI datasource -
i have pretty simple grid data source retrieves data correctly cause have schema.parse function defined
the problem when try update/create new row schema.parse() called again , parameter passed string contains html of page. cannot hell going on there. thanks
var _datasource = new kendo.data.datasource({ transport: { read: { datatype: "json", url: layerdefprovider.getlayerurlbyid("surveys") + "/query", data: { f: "json", //token: token, outfields: "*", //outsr: 3857, where: "1=1" }, type: "post" }, create: function (options) { console.debug("called");//never gets called }, update: function (options) { console.debug("called");//never gets called }, destroy: function (options) { console.debug("called");//never gets called } }, filter: { field: "objectid", operator: "eq", value: 0 }, schema: { data:function(response) { }, parse: function (data) {//on loading fine, on updating data param string of html of page var rows = []; var features = data.features; if (!features) { return []; } (var = 0; < features.length; i++) { var datarow = {}; datarow.objectid = features[i].attributes.objectid; datarow.name = features[i].attributes.name; datarow.date = features[i].attributes.date; datarow.comment = features[i].attributes.comment; rows.push(datarow); } return rows; }, model: { id: "objectid", fields: { objectid: { type: "number", editable: false }, name: { type: "string" }, date: { type: "string" }, comment: { type: "string" } } } } }); var _surveyspicker = $(config.table).kendogrid({ toolbar: ["create","save"], editable: true, datasource: _datasource, height: 300, sortable: true, selectable: "multiple", columnmenu: true, resizable: true, columns: [{ field: "objectid", width: 40 }, { field: "name", width: 40 }, { field: "date", width: 40 }, { field: "comment", width: 100 }] });
you need move parse function inside read event if need parse data on read action.
Comments
Post a Comment