Kendo ui 剑道UI网格多选速度慢且无响应
我有一个剑道UI网格,它允许使用每行上的复选框进行多行选择 当我选择每个项目时,在突出显示行之前会有一个延迟。 选择会逐渐变慢,并最终失去响应 我怀疑在函数updateNameList中添加/删除类是罪魁祸首,但不知道实现这一点的其他方法 谢谢你的帮助Kendo ui 剑道UI网格多选速度慢且无响应,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我有一个剑道UI网格,它允许使用每行上的复选框进行多行选择 当我选择每个项目时,在突出显示行之前会有一个延迟。 选择会逐渐变慢,并最终失去响应 我怀疑在函数updateNameList中添加/删除类是罪魁祸首,但不知道实现这一点的其他方法 谢谢你的帮助 @(Html.Kendo().Grid<MyItems>() .Name("MyItems") .DataSource( datasource => datasource
@(Html.Kendo().Grid<MyItems>()
.Name("MyItems")
.DataSource(
datasource => datasource
.Ajax()
.ServerOperation(false)
.Read(read => read.Action("GetMyItems", "ItemMgr", new { id = new Guid("E1CB204D-74CD-4995-A14F-F5A6FFFCB2E7"), accountid = ViewBag.AccountId }))
.Model(m => m.Id(mx => mx.ItemId))
)
.Columns(columns =>
{
columns.Bound(c => c.Name).Template(@<text></text>).ClientTemplate("<input type='checkbox' class='name-select-chk' data-target='#= Name #' />").HeaderTemplate("").Width(20);
columns.Bound(c => c.Name).Width(60).Title("Name");
columns.Bound(c => c.Status).Width(60).Title("Status");
.Filterable()
.Sortable()
.Selectable(select => select.Mode(GridSelectionMode.Single))
.Events(
e=>e.Change("selection_change")
)
)
function selection_change(arg) {
var selectedItem = this.dataItem(this.select());
if ($.inArray(selectedItem.Name, selectedNames) >= 0) {
selectedNames.splice(selectedNames.indexOf(selectedItem.Name), 1);
} else {
selectedNames[selectedNames.length] = selectedItem.Name;
}
updateNameList(arg);
}
function updateNameList(e) {
var Names = "";
for (i = 0; i < selectedNames.length; i++) {
Names += selectedNames[i];
if (i < selectedNames.length-1) {
Names += ", ";
}
}
$("#MyItems tr").each(function (index) {
$(this).removeClass("k-state-selected");
$(this).find("input").prop('checked', false);
for (i = 0; i < selectedNames.length; i++) {
if ($(':nth-child(2)', this)[0].innerHTML == selectedNames[i]) {
$(this).addClass("k-state-selected");
$(this).find("input").prop('checked', true);
}
}
});
}