Grid selection get out of sync with filtering/sorting

2 posts, 0 answers
  1. Ján
    Ján avatar
    18 posts
    Member since:
    Jun 2017

    Posted 04 Aug 2017 Link to this post


    we are using Kendo UI for Angular 2 and we have an issue with grid selection. We are hooked to selectionChange event to keep track of selected item.

    When an item is selected in a grid the event fires and we know what was selected/deselected, thats fine. The problem is that when grid is filtered/sorted the underlying items change, but the selection stays. For example  - the first row is selected, then the grid is sorted - in grid still the first row is highlighted, although it now contains completely different item and there is currently no way of knowing what item it is as selectioChange event is not fired. So our selected item is out of sync with UI presentation.

    I believe that the selection should be cleared when filtering/sorting or selectionChange event should fire if different item not occupies the spot. But currently there is no way of doing any of those things.

  2. Dimiter Topalov
    Dimiter Topalov avatar
    1296 posts

    Posted 07 Aug 2017 Link to this post

    Hi Ján,

    The described issue is caused by the fact that the current Grid selection functionality exposes the absolute row index of the selected row only, and it is not directly correlated to the actual data item.

    We recently released a serious reimplementation of the selection functionality, and many new features like multiple row selection, programmatic selection, selection via checkbox column, as well as an API for obtaining the currently selected data items, is now available out-of-the-box.

    The development build should is now available, and you can get more details about the enhancements, and how to install and use this release in the following GitHub issue:

    Meanwhile, you can obtain the correct item by processing the data in accordance with the current Grid State (sorting, paging etc. config), for example:

    In scenarios, involving grouped data, the data should be flattened first, as it has different structure, and then the item should be obtained by the respective index, e.g.:

    I hope this helps.

    Dimiter Topalov
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top