Suppose you have a FormTreeControl and you want to delete a node of the tree. When the error "The transaction cannot be deleted because subtransactions exist" occurs it means that you cannot delete the node because it has sub node in the tree. Before you delete your node you must delete child nodes
Category: FormTreeControl
AX – D365FO – Get selected node of a FormTreeControl
This example shows how to retrieve the selected node of a FormTreeControl and get its text name FormTreeItem selectedItem; selectedItem = tree.getItem(tree.getSelection()); //Tree is the current FormTreeControl info(selectedItem.text());
AX – D365FO – Get FormTreeControl node RecId
Follow this code if you want to get the Record identifier (RecId) of a FormTreeControl node RecId currentRecordRecId = FormTreeControl.getItem(_node).data();
AX – D365FO – Set ForTreeControl node as bold
If you want to mark a tree node as bold just folllow this code public void setTreeNodeBoldIfIsNotVendorActivity(FormTreeControl _formTreeControl, int _node) { formTreeItem formTreeItemNode = _formTreeControl.getItem(_node); formTreeItemNode.stateBold(true); _formTreeControl.setItem(formTreeItemNode); } This will be the result
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 … Continue reading AX – D365FO – Auto collapse whole tree in FormTreeControl
AX – D365FO – Use checkbox in FormTreeControl
If you want to use checkboxes in a FormTreeControl follow these instructions. In the tree contol set these 3 properties values : AutoDeclaration = YesCascadeSelect = NoCheck Box = Yes To get this result Follow this code FormTreeItem formTreeItemNode = ActivityTree.getItem(ActivityTree.getSelection()); formTreeItemNode.stateChecked(FormTreeCheckedState::Checked); ActivityTree.setItem(formTreeItemNode); ActivityTree is the name of the FormControlTree control If you want to … Continue reading AX – D365FO – Use checkbox in FormTreeControl
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 … Continue reading AX – D365FO – Auto expand whole tree in FormTreeControl
AX – D365FO – Create a Simple and Detail – Tree Form
This article is dedicated to my colleague Andrew Nearness This example shows how to create a "Simple and create Detail - Tree" Form This is the result we want to obtain First create Extended data types Al0VendorActivityId of type Int64 Al0VendorActivityName of type String Al0VendorActivityHierarchyId of type Int64 Then create "Al0VendorActivity" table Add these fields … Continue reading AX – D365FO – Create a Simple and Detail – Tree Form
AX – D365FFO – FormTreeControl – Change the display label (Text) on a FormTreeItem
In a Tree view te default label is RecId and Name. If you want to change it follow this code ... int idx = tree.getSelection(); //Get the selected node FormTreeItem formTreeItem = tree.getItem(idx); // get the visual node formTreeItem.text("hello"); // change the display text from whatever, to "hello" tree.setItem(formTreeItem); // update that node in the … Continue reading AX – D365FFO – FormTreeControl – Change the display label (Text) on a FormTreeItem