Restore selected/expanded row under column grouping

2 posts, 0 answers
  1. Kun
    Kun avatar
    44 posts
    Member since:
    Aug 2018

    Posted 21 Mar 2019 Link to this post


    I've posted a thread about save/restore row 2 months ago. It worked great until I grouped a column.

    When a column is grouping, the row index that I save/restore is the index in the grouping zone where the row located. When I load this row index to the gridview, every grouping zone will take over this row index. For example if I save a selected row, when I reload its index, all rows which has this index in every grouping zone will be selected.


    If you would like to test, check out the demo in my old post (Hristo's answer):


    Thank you by advance for your help.


  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3955 posts

    Posted 22 Mar 2019 Link to this post

    Hello, Kun, 

    I have tested the sample project from the referred feedback item. Note that RadGridView exposes two collections that contain data rows:

    - Rows - contains all data rows that belong to RadGridView. Data operations such as grouping, sorting, filtering, etc. do not change the content of the collection or the order in which the row objects exist in the collection.
    - ChildRows - returns the data rows that are currently represented by RadGridView in the order in which they appear. The collection is modified every time a data operation (grouping, sorting, filtering) occurs.

    The Index property of the row uses internally the ChildRows collection of the respective parent to give you index. When you group the grid, a new level will be created for the groups and the index will be different since the ChildRows collection will be changed.

    The possible solution that I can suggest is to store the GridViewRowInfo instance itself, not the index. Thus, once you store the expanded row objects, you can traverse the rows recursively and check whether the current row is already stored in the expanded collection and this restore the expanded state. Thus, you will not be worried about the grouping, filtering or sorting index changes that may occur.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top