yagocor
2022-05-18T05:44:50Z
hello,

for manual insert, is possible append child rows in random order?

in your example is possible only in sequential mode:
- root
--child

instead i want use your grid in this mode:
- root_1
- root_2
- root_N

and after add child rows
--child_of_root_2
--child_of_root_1
--child_of_root_3


thanks in advance
best regards
Igor/10Tec
2022-05-19T16:34:50Z
Yes, sure. You can insert root and child rows in any order. The only obvious recommendation is that a parent must be inserted before you add its children.
yagocor
2022-05-19T18:01:52Z
hello Igor,

thank you so much for your reply


but your reply not resolve my problem because i should always bound to add first the parent


my situation is this: first i load all the parents and only after i want to hang up the children (example: lazy load of child after click on the parent...just for speedup the execution)

best regards
Igor/10Tec
2022-05-20T15:38:06Z
Perhaps, we do not understand each other. Yes, what you described in your last post is possible.

If you have problems with implementing this functionality, you can send us a sample for further consideration. One code sample is worth a thousand words 🙂
yagocor
2022-05-20T18:16:13Z
from your iGridTreeHelperMethods_VB example:

original code:

iGrid1.AddRootNode("Root 1", "1")
iGrid1.AddChildNode("1", "Child 1.1")
iGrid1.AddChildNode("1", "Child 1.2", "1.2")
iGrid1.AddChildNode("1", "Child 1.3", "1.3")
iGrid1.AddChildNode("1.3", "Child 1.3.1")
iGrid1.AddChildNode("1.3", "Child 1.3.2")

Dim myRowRoot2 As iGRow = iGrid1.AddRootNode("Root 2") ' AddRootNode() returns the created iGRow object,
iGrid1.AddChildNode(myRowRoot2, "Child 2.1") ' which can be used later In AddChildNode() instead of parent string key
iGrid1.AddChildNode(myRowRoot2.Index, "Child 2.2") ' or we can even use numeric row index

iGrid1.AddRootNode("Root 3")



my test code:

iGrid1.AddRootNode("Root 1", "1")
iGrid1.AddChildNode("1", "Child 1.1")
iGrid1.AddChildNode("1", "Child 1.2", "1.2")
iGrid1.AddChildNode("1", "Child 1.3", "1.3")
iGrid1.AddChildNode("1.3", "Child 1.3.1")
iGrid1.AddChildNode("1.3", "Child 1.3.2")

Dim myRowRoot2 As iGRow = iGrid1.AddRootNode("Root 2") ' AddRootNode() returns the created iGRow object,

iGrid1.AddRootNode("Root 3")

... run code...and...
iGrid1.AddChildNode(myRowRoot2, "Child 2.1")
iGrid1.AddChildNode(myRowRoot2.Index, "Child 2.2")


the child "2.1 and 2.2" are added to "root 3" instead of "root 2"

regards
Igor/10Tec
2022-05-23T16:24:41Z
Now all is clear - the method names misled you. The Add* methods are used when rows are added to the END of iGrid. They just wrap some row-level-related functionality implying that rows are added to the end. What you need is the equivalent Insert* methods:

iGrid1.InsertChildNode(myRowRoot2, "Child 2.1")
iGrid1.InsertChildNode(myRowRoot2.Index, "Child 2.2")