PDA

View Full Version : [CLOSED] TreePanel - SubmittedNode - Get Children SubmittedNodes



John_Writers
Feb 25, 2014, 4:56 PM
Hi,
I'm working with a treepanel.

I need to get (Server side) a list containing all the tree nodes which are children of the selected node. (the tree is in single select mode).

So, I did that with a recursive function, but the field Children of a SubmittedNode is always empty, so this recursion doesn't work.



private List<int> GetComponentiFigli() {
List<int> res = new List<int>();
List<SubmittedNode> lstSubmitted = new List<SubmittedNode>();


lstSubmitted = GetChildSubmittedNode(TreeFunctional.SelectedNodes[0], lstSubmitted);


foreach (SubmittedNode s in lstSubmitted)
res.Add(Convert.ToInt32(s.Attributes["ID_INV_REGISTRY"]));
return res;
}


private List<SubmittedNode> GetChildSubmittedNode(SubmittedNode node, List<SubmittedNode> list)
{
foreach (SubmittedNode i in node.Children)
list.AddRange(GetChildSubmittedNode(i, list));
return list;
}


Thanks for your time.

Have a good day!

Daniil
Feb 26, 2014, 8:50 AM
Hi @John_Writers,

Please set up the following setting.

<ext:TreePanel ID="TreePanel1" runat="server">
<SelectionSubmitConfig WithChildren="true" />
</ext:TreePanel>

John_Writers
Feb 27, 2014, 1:42 PM
Great!
It works!

Thank you, have a good day.