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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Three Grid View

Thread ID:

Created:

Updated:

Platform:

Replies:

123737 Apr 15,2016 12:11 PM UTC Apr 20,2016 01:33 AM UTC WPF 1
loading
Tags: GridTreeControl
lukasz.szeszol
Asked On April 15, 2016 12:11 PM UTC

Hello,
Is there a posibity to attach a new node to an existing treeview without recursive walking throught the tree.
I have a unique id fo each row.
For example i nedd to and a new item to Chilfd nodes collection of node with id 99
Can i do this without recursive walking the tree?
Thanks

Srinivasan Vasu [Syncfusion]
Replied On April 20, 2016 01:33 AM UTC

Hi Lukasz,

Thanks for contacting Syncfusion Support.

We have analyzed your query and we are prepared a sample as per your requirement.  In this sample, we have a unique ID for each parent node and you can add a new item to child node collection by searching the ID parent node using GridTreeControl.InternalGrid.Nodes collection. It is not possible to find the parent node without any recursive methods or loops.

Please refer the below code sample

C#

private void Button_Click(object sender, RoutedEventArgs e)

        {           

            var viewModel = this.treeGrid.DataContext as ViewModel;


                var node = new PersonInfo() { Id = 0, LastName = "Buchanan", FirstName = "Pradap", Designation = "Employee", DOB = new DateTime() };

            

                foreach (var item in this.treeGrid.InternalGrid.Nodes)

                {

                if (item.ParentNode == null)

                {                   

                    if ((item.Item as PersonInfo).Id == node.Id)

                        {

                            // Node added

                            item.ChildNodes.Add(new GridTreeNode(item.Level+1, node, false, item));

                        }

                   }                   

                }

                treeGrid.InternalGrid.ReloadNodes();           
        }       


Please find the sample from the below location,

Sample Location: http://www.syncfusion.com/downloads/support/forum/123737/ze/GridTreeControlSample-1137983568
 
Regards,
Srinivasan


CONFIRMATION

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.

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

;