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

Datasource refresh without closing the tree

5 Answers 52 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Halász Levente
Top achievements
Rank 1
Halász Levente asked on 19 Aug 2010, 06:16 AM
Hi,

I'd like to use RadTreeViewList with RIA, but my problem is that whenever I refresh the datasource the whole tree collapses. Is there a way to avoid this collapsing.

Thank you for your answer,

Levente

5 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 19 Aug 2010, 01:22 PM
Hi Halász Levente,

Can you share more details about your refresh? Are you using a DomainDataSource and calling its Load() method?

If you are assigning a new ItemsSource RadTreeListView will recreate its internal expand/collapse storage mechanisms so you will have to restore the expand/collapse state on your own. If you want to avoid a possible solution is to you can use a single observable collection as ItemsSource.

Kind regards,
Stefan Dobrev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Halász Levente
Top achievements
Rank 1
answered on 19 Aug 2010, 02:02 PM
Hi Stefan,

I'm using DomainDataSource and I'm calling it's load method, with LoadBehavior.MergeIntoCurrent, so there is no reassignment of ItemsSource.

I fount a possible work around, by writing a Behavior which binds the rows IsExpanded property to a list to store which elements were expanded before datasource refresh. The problem is that when I set IsExpanded back to true, after datasource refresh (to restore the initial tree) the treeviewlist doesn't render correctly (it has white areas instead of my structure). If I call ExpandHierarchyItem method, then it is OK. It also renders correctly if I resize the treeviewlist control.
0
Halász Levente
Top achievements
Rank 1
answered on 19 Aug 2010, 03:38 PM
I also noticed, that the treelistview collapses no matter what I do with the items source (even if I don't touch it) as soon it receives NotifyPropertyChanged.
0
Stefan Dobrev
Telerik team
answered on 25 Aug 2010, 09:45 AM
Hello Halász ,

Looking at the internals of RadTreeListView it seems that whenever an item is removed from the source collection it is collapsed in the internal storage of the control, so an extra step to expand it back is necessary when this item comes back in the items source.

Best wishes,
Stefan Dobrev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Halász Levente
Top achievements
Rank 1
answered on 25 Aug 2010, 10:58 AM
Thank you for your answer. The is unfortunate, however I rewrote the whole stuff and using ObservableCollection now as data source. It works OK.
Tags
TreeListView
Asked by
Halász Levente
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Halász Levente
Top achievements
Rank 1
Share this question
or