コードのスリム化されたバージョンは次のとおりです。
gridDataSource = new kendo.data.DataSource({
batch: true,
transport: {
read: {
url: 'Equipment'
},
destroy: {
url: 'Equipment',
contentType: "application/json",
dataType: 'json',
type: "DELETE"
},
parameterMap: function (options, operation) {
if (operation == "read") {
return "this=works-fine";
} else {
alert('not reading');
return kendo.stringify(options.models);
}
}
},
schema: {
id: "EquipmentId",
fields: {
Value: { type: "number" }
}
}
});
kendoGrid = gridObj.kendoGrid({
dataSource: gridDataSource,
selectable: 'row',
navigatable: true,
change: rowSelect,
sortable: true,
pageable: false,
columns: [
{ field: "Value" },
]
}).data('kendoGrid');
そして、読み取りは問題なく機能します。これで行(または多く)を削除します(selectedRowは正しく入力されていますが、簡潔にするためにスキップされています):
$('#footer-remove').off().on('click', function () {
kendoGrid.removeRow('table tr[data-uid="' + selectedRow.uid + '"]');
console.log(gridDataSource._destroyed);
});
そして、それは gridDataSource._destroyed に表示され、私のすべてのテストはすべて、gridDataSource が汚れていることを示しています。
sync を呼び出しても、単に削除しているだけでは何も起こりません。私は何が欠けていますか?ありがとうございました。