$("#grid").kendoGrid({
dataSource: {
transport: {
read: function(options) {
$.ajax( {
url: "/api/mygetfunction",
data: options.data,
success: function(result) {
options.success(result);
}
});
},
update: function (options) {
$.ajax({
url: "/api/myupdatefunction",
data: options.data,
success: function (result) {
options.success(result);
}
});
},
destroy: function (options) {
$.ajax({
url: "/api/mydestroyfunction",
data: options.data,
success: function (result) {
options.success(result);
}
});
},
create: function (options) {
$.ajax({
url: "/api/mycreatefunction",
type: 'POST',
data: ...
});
},
parameterMap: function (options, operation) {
if (operation !== "read") {
return JSON.stringify(options);
}
}
},
schema: {
id: "Id",
model: {
fields: {
Id: { type: "string" },
Description: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: false,
serverFiltering: false,
serverSorting: false,
batch: false
},
toolbar: ["create"],
filterable: true,
sortable: true,
pageable: true,
columns: [
{
field: "Description",
title: "Description"
},
{ command: ["edit", "destroy"], title: " ", width: "210px" }
],
editable: "inline"
});
网格有 3 行。当我单击编辑时,我更改了描述列。然后我单击更新,网格会调用传输配置的“创建”。我已将批处理设置为 false,奇怪的是,有 3 个创建而不是更改的行。
编辑网格导致创建而不是更新的原因是什么?