This is a migrated thread and some comments may be shown as answers.

Prevent scroll on save with virtual scrolling

5 Answers 627 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 27 Oct 2016, 05:59 PM

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

Sort by
0
Marc
Top achievements
Rank 1
answered on 27 Oct 2016, 06:59 PM

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?

0
Dimiter Topalov
Telerik team
answered on 31 Oct 2016, 08:48 AM
Hi Marc,

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
Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
0
Marc
Top achievements
Rank 1
answered on 01 Dec 2016, 04:35 PM

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;
}

0
David
Top achievements
Rank 1
answered on 14 Nov 2017, 09:31 PM
@Marc, this definitely stops the auto scrolling after binding, But doesn't update the row until you either click off it or manually scroll. Did anyone ever find out how to just stop it from scrolling everywhere after binding with virtual scrolling?
0
Stefan
Telerik team
answered on 16 Nov 2017, 12:28 PM
Hello, David,

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
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
Marc
Top achievements
Rank 1
Dimiter Topalov
Telerik team
David
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or