我有一个带有 Angular 和远程数据绑定的网格。它的配置是这样的:
$scope.myGridOptions = {
dataSource: new kendo.data.DataSource({
type: "json",
transport: {
create: function(operation) {
//calls an Angular service to add
DataService.add(operation).success(function(data) {
operation.success(data);
});
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
}
},
pageSize: 10,
schema: {
model: {
id: "Id",
fields: {
...
}
}),
toolbar: [ { name: "create", text: "Add New Book" } ],
autobind: false,
groupable: false,
editable: {
mode: "inline"
},
columns: [
{
field: "Name",
title: "Name"
},
{
field: "Description",
title: "Description"
},
{
command: [
{ name: "edit", title: "Action" }
]
}
]
};
当我单击“添加新书”按钮时,网格中的第一行变为空白行并允许我输入数据。完成输入后,我单击“更新”以保存数据,第一行变为常规的只读行,我验证新行已添加到远程数据库。到目前为止,一切都很好。但是,当我单击新行上的“编辑”按钮,然后单击“取消”按钮时,我的新行会消失,直到我刷新页面。
我错过了什么?