Ext.Net如何获取TreePanel AS列表中的所有TreeNode
foreach(Node treenode in treepanel.Nodes) {
string nodeID = treenode.NodeID;
}
答案 0 :(得分:0)
你可以递归地做到:
//Create a list
List<Node> list = new List<Node>();
//pass you tree root as a parameter
GetAllNodes(YourTreePanel.root);
protected void GetAllNodes(NodeCollection nodes) {
foreach (Node item in nodes)
{
//if your node has children call the function again
if (item.Children.Count > 0) GetAllNodes(item.Children);
//finally add the node to the list
list.Add(item);
}
}