Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1680
How can I maintain the group by row state (Expanded/Collapsed) after refresh & show selected child row?
posted

Hope you guys are doing great.

I am using win grid & in that I have some groups. When I load the grid first time it shows all the GroupByRows in the collapsed mode. After doing some manipulations on the groups (let’s say I have expanded one group & all other groups are collapsed) & then I have added one row in the data source then win grid gets reloaded & it refreshes & also collapse the entire group by rows again.

How can I maintain the group by row state (Expanded/Collapsed) after refresh & show selected child row?  Some of the folks have written on their post that we should use the display layout for the same but I do not understand the events for the same. & how we can save the display layout of the grid & I do not want to use the Xml file for the saving the display layout.

If possible could you please show some code sample/ sample project for the understanding?

Thanks in advance for your help.

Pradeep      



Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Pradeep,

    If the WinGrid is re-loading the data and losing the current layout, then it means your data source is sending a Reset notification. This does not usually happen when you simply add a single row to the data source. So you are probably doing something more destructive like re-setting the DataSource property of the grid or doing something on your data source which makes it thinks the entire data structure has changed.

    The best thing to do is - avoid doing things like that.

    Of course, this depends on your data source and what you are doing and it may not be possible.

    So an alternative would be to save the grid's layout using one of the Save methods on the grid's DisplayLayout. You could then re-load the layout after the data source operation completes. This will restore layout-level properties such as the grouping. But it cannot restore row-level state information like the expanded or selected state of the rows since this relies on the data. You would have to handle that yourself in code.

Children
No Data