I've searched around a little but can't find a relevent resolution.
On a grid with virtual scrolling (all data is on client), how can I stop Kendo from scrolling to the top of the page after a user does a batch save and the grid rebinds?
5 Answers, 1 is accepted
I found this old post which is likely relevant to the issue I am seeing. Has this been addressed at some point in the last three years?
http://www.telerik.com/forums/virtual-scrolling-grid-re-positioned-after-datasource-read
If not how can I conditionally prevent the rebinding after a save?
Editing and scrolling to a specific data item are documented limitations of the Kendo UI Grid virtualization functionality:
http://docs.telerik.com/kendo-ui/controls/data-management/grid/appearance#limitations-of-virtual-scrolling
The described undesired behavior is a limitation of the virtual scrolling implementation. It is caused by the fact that once the data is refreshed, and the table has been previously scrolled, the Grid rows, and the scrollable container's position become out of sync.
A possible workaround is to store the scroll position before the Grid rebinds, and then programmatically scroll to it on dataBound (a certain timeout depending on the scenario will be required). However, this will not cause scrolling to a specific data item.
You can prevent rebinding by handling the dataBinding event and calling e.preventDefault().
Please note that in general, scenarios, involving virtual scrolling and editing are not supported, and we recommend using regular paging if the Grid must support CRUD operations.
Regards,
Dimiter Topalov
Telerik by Progress
For posterity here is my hack for this.
function onDataBinding(e) {
if (e.action === "sync") {
e.preventDefault();
$("#grid.k-dirty").addClass("k-dirty-clear");
}
}
.k-dirty-clear {
border-width:0;
}
From our 2017 R3 release, we officially support the editing with virtual scrolling.
Please check our new demo and advise if there are any scrolling issue after the new implementation:
http://demos.telerik.com/kendo-ui/grid/virtualization-local-data
Regards,
Stefan
Progress Telerik