我正在使用Kendo Grid,我遇到了destroy命令按钮的问题。按钮按预期工作并调用适当的函数。删除第二行后会出现此问题。在第一次调用时,正确的对象被传递给函数,在连续调用而不是发送对应于按下destroy命令的行的对象时,它从第一次调用的行发送对象。在初始destroy命令之后的每一行都会发生这种情况。调用success函数将导致从网格中删除正确的行,但是当传递不正确的数据时,它永远不会从服务器(WebAPI)中删除。我不确定它是网格配置,数据源配置中的错误还是仅仅是一个错误。我已经包含了下面的当前配置。任何帮助,将不胜感激。谢谢。
vm.gridOptions = {
dataSource: {
//autoSync:true,
schema:{
model: {
id: "id",
fields:{
id:{editable:false},
projectno: {editable: true},
description: {editable: true},
fund: {editable: true},
dept: {editable: true},
org: {editable: true},
grc: {editable: true},
apprunit: {editable: true},
objcode: {editable: true}
}
}
},
transport:{create: createProject, read: readProjects, update:saveProject, destroy: deleteProject}
},
selectable: false,
sortable: true,
editable: { mode:"popup"},
//save: validateProject,
columns: [
{
title: "Project",
field: "projectno",
width: "5%"
},
{
title: "Description",
field: "description",
width: "30%"
},
{
title: "Fund",
field: "fund",
width: "5%"
},
{
title: "Dept",
field: "dept",
width: "5%"
},
{
title: "Org",
field: "org",
width: "5%"
},
{
title: "GRC",
field: "grc",
width: "5%"
},
{
title: "Appr",
field: "apprunit",
width: "5%"
},
{
title: "Obj. Code",
field: "objcode",
width: "5%"
},
{ command: "edit",width: "5%" },
{ command: "destroy",width: "5%" }
]
};
function deleteProject(options){
projectservice.deleteProject(options.data).then(function(data){
options.success(data)
},function(data){
options.error(data);
});
}