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

Partial Refresh of Self Referencing GridView hierarchy

1 Answer 179 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alexis
Top achievements
Rank 1
Alexis asked on 05 Apr 2016, 02:42 AM

I am looking to be able to change the structure of the parent child relationship in a self-referencing hierarchy without losing the currently expanded hierarchy not related to the rows/nodes being removed and replaced.

I successfully have the ParentId and Id relationship displaying as a hierarchy in the grid view by using a BindingList<RowItemWithParentChildRelationship> bound to the DataSource of the RadGridView property.

However when I remove the old rows/nodes that no longer apply and then add the new rows/nodes (to the BindingList<>) to be displayed the radgrid control only displays the old rows being removed and not the new rows that have subsequently replaced the old structure without offering the ability to expand into the new structure.

Am I missing a trick to reparse the hierarchy (without losing the entire expand context) and display the newly added items in the hierarchy?

I can update the DataSource property which off course rebuilds all rows and loses the currently expanded tree but if it is at all possible to avoid this it will make for a much better user experience.

Digging around the available properties of RadGridView I've tried calling,

radGridView.MasterTemplate.HierarchyDataProvider.Refresh();

which I had hoped would reparse the bound data into the tree structure and offer the expansion into the replaced children of the parent node in question but to no avail.

Many thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 05 Apr 2016, 12:45 PM
Hello Alexis,

Thank you for writing.

I believe that you could achieve your task by saving the state of the expanded rows and after you change the data source object restore it. 

I am sending you attached a sample project which I hope could fit your local setup.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Alexis
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or