Kendo UI Grid multi select slow and unresponsive -
i have kendo ui grid allows multiply row selection using check boxes located on each row.
as select each item, there delay before row highlighted. selection becomes progressively slow , unresponsive.
i suspect adding/removal of classes in function "updatenamelist" culprit, not know of way of achieving this.
any appreciated, thanks.
@(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 = ""; (i = 0; < 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); (i = 0; < selectednames.length; i++) { if ($(':nth-child(2)', this)[0].innerhtml == selectednames[i]) { $(this).addclass("k-state-selected"); $(this).find("input").prop('checked', true); } } }); }
Comments
Post a Comment