AX – D365FO – Auto collapse whole tree in FormTreeControl

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

SysFormTreeControl::collapseTree(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:: collapseTree (TreeCtrl, TreeCtrl.getRoot());
Or only from the current selection item down the tree:

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

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