Prevent scroll on save with virtual scrolling

4 posts, 0 answers
  1. Marc
    Marc avatar
    67 posts
    Member since:
    Jul 2010

    Posted 27 Oct Link to this post

    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?

  2. Marc
    Marc avatar
    67 posts
    Member since:
    Jul 2010

    Posted 27 Oct in reply to Marc Link to this post

    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?

  3. Kendo UI is VS 2017 Ready
  4. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    349 posts

    Posted 31 Oct Link to this post

    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.
  5. Marc
    Marc avatar
    67 posts
    Member since:
    Jul 2010

    Posted 01 Dec Link to this post

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

Back to Top
Kendo UI is VS 2017 Ready