AX – D365FO – Auto expand whole tree in FormTreeControl

If you have a Tree control on your form and want to expand the whole tree with all items and subitems at once, you can use the following static method:

SysFormTreeControl::expandTree(FormTreeControl _formTreeControl, TreeItemIdx _treeItemIdx, int _toLevel = 0,int _level = 0 )

For example to expand the whole tree from the root item to the inner most item:

SysFormTreeControl::expandTree(TreeCtrl, TreeCtrl.getRoot());
Or only from the current selection item down the tree:

SysFormTreeControl::expandTree(TreeCtrl, TreeCtrl.getSelection());

This article written by my friend Arun Garg: https://community.dynamics.com/ax/b/dynamicsaxsolutions/posts/auto-expand-whole-tree-in-formtreecontrol

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s