Oracle Forms Tree : Collapse and Expand by Procedures

 PROCEDURE collapse_tree IS

vnode ftree.node;
vhtree ITEM;
vstate varchar2(30);

BEGIN
-- Search the tree identifiant --
vhtree := Find_Item('MENU.TREE4');

-- Search the root --
vnode := Ftree.Find_Tree_Node(vhtree, '');

-- Collapse all nodes --
WHILE NOT ftree.ID_NULL(vnode) LOOP
vstate := Ftree.Get_Tree_Node_Property(vhtree, vnode, Ftree.NODE_STATE);
IF vstate = Ftree.EXPANDED_NODE THEN
Ftree.Set_Tree_Node_Property(vhtree, vnode, Ftree.NODE_STATE, Ftree.COLLAPSED_NODE);
END IF;
vnode := Ftree.Find_Tree_Node(vhtree, '', Ftree.FIND_NEXT,Ftree.NODE_LABEL, '', vnode);
END LOOP;
END;

PROCEDURE EXPAND_tree IS
node ftree.node;
htree ITEM;
state varchar2(30);

BEGIN
-- Search the tree identifiant --
htree := Find_Item('MENU.TREE4');

-- Search the root --
node := Ftree.Find_Tree_Node(htree, '');

-- Expand all nodes --
WHILE NOT Ftree.ID_NULL(node) LOOP
state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
IF state = Ftree.COLLAPSED_NODE THEN
Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.EXPANDED_NODE);
END IF;

node := Ftree.Find_Tree_Node(htree, '', ftree.find_NEXT,Ftree.NODE_LABEL,'', node);

END LOOP;
END;


Muhammad Abdullah Al Noor

Muhammad Abdullah Al Noor, An Oracle Apex Consultants and founder of Noors Technology (www.noorstech.com). Core Expertise : Database Administration, Oracle Forms and Reports Development, Oracle Apex Application Designer and Development, Linux Professional etc. Also the owner of TrainerBD Training and OraDemy E-Learning. WhatsApp +8801790721177

Post a Comment

Previous Post Next Post