Work with values tree. Managed interface.

Example of work with values tree from the managed form. The catalog “Goods” is displayed in respect to the hierarchy with an ability to select either the item or the group (the items contained in the group are also selected). The work with values tree is demonstrated with an arbitrary hierarchy level using the recursive function.

I decided to use the most interesting situation - when it is not known in advance the depth of tree and the traversal is performed using a small recursive procedure. It is possible to select a group, and the items contained in the group are also selected. It is possible to select the root item - then all ingressed groups and items will be selected.

If it is required to traverse the tree - there is a button “Traverse tree”. When clicking, the selected items (just items) are saved in the array. I tried to make everything as optimally as possible and the server call occurs only during the tree generation when opening. Further, only the client is working. In my opinion, it turned out quite beautiful and the code is not big.

Maybe somebody will need it in order to recall the work with values tree, especially in the managed interface :).

You can download dump of information base below this publication.

Publications: Work with values tree. Managed interface.


Click to rate this post!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published. Required fields are marked *