如何从Kendo Grid中删除一行 [英] How do I remove a row from a Kendo Grid
本文介绍了如何从Kendo Grid中删除一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常简单的设置,一个名为#list的网格,其中一个数据源填充了要显示的记录。
每行上都有一个带有onClick的按钮调用此函数的事件:
I have a very simple setup, a grid called #list with a datasource populated with records to display.
I have a button on each row with an onClick event that calls this function:
// Soft-Delete person
var processURL = crudServiceBaseUrl + '?method=deletePerson';
function deletePerson(id){
if (confirm('#getResource("person.detail.confirmdel")#')) {
$.ajax({
type: 'POST',
url: processURL,
data: {
PERS_KY: id
},
success: function (data){
var thingToDelete = "tr:eq("+id+")";
var grid = $("#list").data("kendoGrid");
grid.removeRow(thingToDelete);
},
error: function (xhr, textStatus, errorThrown){
alert("Error while deleting person"+ "\n"+ xhr + "\n"+ textStatus + "\n" + errorThrown);
}
});
}
}
服务器端的工作正常,与数据库的交互很好。但是,该行不会从网格中消失。
任何人?
The server-side stuff works fine, the interaction with the database is good. However, the row does not disappear from the grid.
Anyone?
推荐答案
.ajax({
类型:' POST',
url:processURL,
数据:{
PERS_KY:id
},
成功: function (数据){
var thingToDelete = tr:eq( + id + );
var grid =
.ajax({ type: 'POST', url: processURL, data: { PERS_KY: id }, success: function (data){ var thingToDelete = "tr:eq("+id+")"; var grid =
( #list)。data(< span class =code-string> kendoGrid);
grid.removeRow(thingToDelete);
},
错误: function (xhr,textStatus,err orThrown){
alert( 删除人员时出错 + \ n + xhr + \ n + textStatus + \ n + errorThrown);
}
});
}
}
("#list").data("kendoGrid"); grid.removeRow(thingToDelete); }, error: function (xhr, textStatus, errorThrown){ alert("Error while deleting person"+ "\n"+ xhr + "\n"+ textStatus + "\n" + errorThrown); } }); } }
服务器端的工作正常,与数据库的交互很好。但是,该行不会从网格中消失。
任何人?
The server-side stuff works fine, the interaction with the database is good. However, the row does not disappear from the grid.
Anyone?
这篇关于如何从Kendo Grid中删除一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文