I am trying to insert a node into a TreeListMenu. It can successfully add nodes into a tree, at different level - using parent and child relationship. The function I am using is:
this->tree_control0->InsertNode(CurrentNOde, ParentNode, NULL, Tree::NodeInsertOptionAlwaysFirst);
However, the order of the nodes within the same level goes as the default order, no matter how I insert them. For example, if I would like to list a tree as (L0=level 0, L1=level 1):
where 'a' and 'b' are parent nodes, but 'b' and 'c' are child nodes of node 'a'. The problem is, no matter I insert 'b' first or 'c' first, it will always be displayed as 'c' listed after 'b'. This seems to follow apathetic order. (if I change the name of 'b' to be 'm' for example, the list will automatically updated as 'm' after 'c' in Level 1(L1).
Could anyone suggest a method that I may list the tree nodes in the way the user wanted but rather than default? I tried to change the option 'NodeInsertOptionAlwaysFirst' as other options, it doesn't help.
Solved! Go to Solution.
After you have added your column to your tree list you can set the sorting option for that column.
I have a feeling the default is sorted ascending, but you can choose unsorted, in which case I expect the nodes will appear in the order they are added.
From memory you have to do something like:
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | KF
Production: NX184.108.40.206 MP11 64bit Testing: NX220.127.116.11
Thanks Graham. What you have said makes a perfect sense. After attempting some changes to the code, now the tree nodes are inserted according to the insertion sequence. Two changes I made are:
1. this->tree_control0->SetColumnSortOption(assName, Tree::ColumnSortOptionUnsorted); //set the column insertion option as "ColumnSortOptionUnsorted".
2. this->tree_control0->InsertNode(currentnode, parentnode, NULL, Tree::NodeInsertOptionLast); //Set the node insertion option as "NodeInsertOptionLast".
Many thanks again!