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

Preserve Expand / Collapsed

2 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 2
Matt asked on 28 Mar 2011, 04:36 PM
I've got a scenario that requires me to change out a data collection. I'm trying to preserve the scroll position and set of Expanded / Collapsed rows with a TreeListView.

The thought is something like this:

  1. Store current scroll position
  2. Store information on which items are collapsed / expanded
  3. Do my changes that cause a list refresh / scroll / expanded reset
  4. Expand all the items that should be expanded
  5. Scroll to the right place

Ideally this should present a relatively accurate and seamless experience to the user.

I can work things out with the scrolling, but I can't find a good way of determining if a given RadTreeListView thinks that a particular row is expanded or collapsed. I can get events on expanded changed / changing, but I don't know what value its changed / changing to, so that's fairly useless for my purposes.

Really, I just want to loop through my collection of items and ask the grid if that row is expanded / collapsed. The particular row shouldn't need to be visible on the grid or anything.

Unfortunately, I can't find a way of doing this.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 30 Mar 2011, 02:04 PM
Hello,

I believe that you can use RowIsExpandedChanged event to check when the row is expanded or collapsed. The data item bound to this row can be referenced using DataContext property of the row. 

All the best,
Vlad
the Telerik team
0
Matt
Top achievements
Rank 2
answered on 30 Mar 2011, 02:16 PM
Yeah. I discovered I could cast e.Row to a TreeViewListRow (or similar name) and look at the IsExpanded property on that object, but typically with changed / changing events the NewValue and OldValue are presented in the event args so you know what it's changed / changing to / from so that's what confused me there.
Tags
GridView
Asked by
Matt
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Matt
Top achievements
Rank 2
Share this question
or