We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Preserve state after refreshing the control.

Thread ID:





132842 Sep 25,2017 08:04 AM UTC Oct 3,2017 03:46 PM UTC WPF 3
Tags: GridTreeControl
Asked On September 25, 2017 08:04 AM UTC

I have a "gridtreecontrol", with 4 child level, When i expand my control items at any level either (3/4) and select the row and double click on it, it open a popup window where i can update the data value of row then save it after closing on popup window "gridtreecontrol" Datasource is updated and it refresh the grid.

Issue: after Grid refresh i loose the state of "gridtreecontrol" and it reverted to the initial state.

                    1. There should be any state persistence mechanism, so that i can preserve and load state of control before/after refresh.
                    2. Or there should be something which silently update the datasource of control and reflect updated value on items, without effecting the current state of "gridtreecontrol"

Muthukumar Kalyanasundaram [Syncfusion]
Replied On September 28, 2017 04:13 AM UTC

Hi Rajiv, 

Thank you for contacting Syncfusion product. 

As per the scenario we have loaded the popup in the view while made a double click in the 3rd level. In the popup closing event, we have updated the content of the popup element in to appropriate cell based upon the row and column index. If I misunderstood your query means please provide us simple sample or try to reproduce the reported issue on below sample so that it would be helpful for us to provide a solution as soon as possible. Please refer the attached sample. 

Please let us know if you have any other questions. 

Muthukumar K 

Replied On September 29, 2017 08:31 AM UTC

Hi MuthuKumar,

Thanks for your quick response.

Actually the actual scenario is different than given sample application, based on the single row data change, all grid data is recalculated on server side and all row data is again pulled from server, and tree grid data is re-render as fresh view.

So in such scenario-How to preserve the state? Please let me know if i am still not clear.

Muthukumar Kalyanasundaram [Syncfusion]
Replied On October 3, 2017 03:46 PM UTC

Hi Rajiv, 
Thank you for your update. 
We have checked your query. you can preserve the state of expand and collapse in GridTreeControl by using below approaches. If you want to load the view by any of the customized pattern means kindly have that kind of code inside the Loaded event as like below 
Code Snippet:C# 
private void TreeGrid_Loaded(object sender, RoutedEventArgs e) 
    // to get the rootnode of Grid treeControl 
    var rootnode = this.treeGrid.InternalGrid.RootNodes[0]; 
    // whether the root node is expanded/no 
    var rootexpanded = rootnode.Expanded; 
    // to get the childnode of 1st child 
    var childnode = this.treeGrid.InternalGrid.RootNodes[0].ChildNodes[0]; 
    var childnodeexpanded = childnode.Expanded; 
    //to get the childnodes of 1st parent node 
    var childnodes = this.treeGrid.InternalGrid.RootNodes[0].ChildNodes; 
At the sample if you want to apply this in runtime means kindly maintain this code inside the click event of the Button or any framework element to meet this requirement. 
We suggest you to use SfTreeGrid control. SfTreeGrid is a data oriented control that displays the self-relational and hierarchical data in tree structure with columns and the data can be loaded on-demand also. SfTreeGrid has multiple features like Sorting, Filtering, Editing, Node CheckBox, Data validation, Selection, Exporting, Clipboard support etc. For more details about SfTreeGrid, you can refer the below link.    

You can preserve the state of expand and collapse in SfTreeGrid as like below code. For your reference, we have attached simple sample  in the below location. Could you please refer to it. 

Code snippet: C# 
private void TreeGrid_Loaded(object sender, RoutedEventArgs e) 
    // to get the view root node of treeGrid             
    var rootnode = this.treeGrid.View.Nodes[0]; 
    // whether the root node is expanded or not, if root node is not expanded, then it will expand using ExpandNode() method. 
    if (!rootnode.IsExpanded) 
    //to get the childnode 
    var childnode = this.treeGrid.View.Nodes[0].ChildNodes[0]; 
    // to check and expand the childnode 
    if (!childnode.IsExpanded) 

Please let us know if you have any other questions. 

Muthukumar K 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon