Home » Developer & Programmer » Forms » !Urgent !Updating the table in Hierarchical Tree
!Urgent !Updating the table in Hierarchical Tree [message #86161] |
Sun, 05 September 2004 19:00 |
rupa
Messages: 41 Registered: August 2002
|
Member |
|
|
Hi Friends!
Could you please help me how to add/delete nodes in a tree and update the base table whenever add/delete nodes. I posted this message few days back but noone responded. So if there is any gems in this forum pls help me.
Thanks,
Rupa
|
|
|
Re: !Urgent !Updating the table in Hierarchical Tree [message #86163 is a reply to message #86161] |
Mon, 06 September 2004 02:39 |
Karthik
Messages: 63 Registered: February 2000
|
Member |
|
|
hi rupa,
I'm here to help you. This prodecure will help you to add a node in a tree., in next mail i will sent how to delete a node in a tree.
eg :- add_tree_branch('tree_block.htree3', :emp.ename, :emp.manager)--
PROCEDURE ADD_TREE_BRANCH (TREE VARCHAR2, ITEM_LABEL VARCHAR2, ITEM_ICON VARCHAR2 , ITEM_VALUE VARCHAR2 DEFAULT NULL,PARENT VARCHAR2 DEFAULT NULL) IS
BEGIN
-- Find the tree itself.
htree := Find_Item(tree);
-- Find the node under which new node is to be added
if parent is not null then
find_node := Ftree.Find_Tree_Node(htree, parent, Ftree.FIND_NEXT,
Ftree.NODE_LABEL, Ftree.ROOT_NODE, Ftree.ROOT_NODE);
-- Add the node to the tree under the found node
new_node := Ftree.Add_Tree_Node(htree,
find_node,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
item_label,
item_icon,
item_value);
else
-- Add the node to the tree under the root node
new_node := Ftree.Add_Tree_Node(htree,
Ftree.ROOT_NODE,
Ftree.PARENT_OFFSET,
Ftree.LAST_CHILD,
Ftree.EXPANDED_NODE,
item_label,
item_icon,
item_value);
end if;
Ftree.Set_Tree_Selection(htree, new_node, Ftree.SELECT_ON);
END ADD_TREE_BRANCH;
|
|
|
Re: !Urgent !Updating the table in Hierarchical Tree [message #86172 is a reply to message #86163] |
Mon, 06 September 2004 18:25 |
Karthik
Messages: 63 Registered: February 2000
|
Member |
|
|
Hi Karthik!
Thanks for your reply. I could manage to add and delete nodes,subnodes to the tree. And these are working properly. But the thing is when I add/delete nodes it's not updating my table. Could you pls help me, how I can update my table when I add/delete nodes,subnodes. One more thing is when I add a node it's always giving the item names as '1510'. How can I change the node names at the run time and update the same in my table at the same time.(Eg. from '1510' to 'Karthik' or 'Manager',etc)
I am just giving my add code and delete code. Pls advice me if there is any need of change in my code.
I created two buttons(add & delete) on my form on different blocks(different from tree block).And I coded for the buttons as ....
Add:
----
declare
htree ITEM;
top_node ftree.node;
new_node ftree.node;
item_value varchar2(30);
find_node ftree.node;
node_depth number;
node_value varchar2(100);
begin
htree := Find_Item('MYTREE_BLK.MY_CODE');
find_node := :SYSTEM.TRIGGER_NODE;
new_node := Ftree.add_tree_node(htree,
find_node,ftree.parent_offset,
Ftree.last_child,
Ftree.expanded_node, item_name, NULL,
item_value);
end;
Delete:
-------
DECLARE
htree ITEM;
num_selected NUMBER;
BEGIN
-- Find the tree itself
htree := Find_Item('MYTREE_BLK.MY_CODE');
num_selected := Ftree.Get_Tree_Property(htree,
Ftree.SELECTION_COUNT);
FOR j IN num_selected..1 LOOP
Ftree.Delete_Tree_Node(htree,
Ftree.Get_Tree_Selection(htree, j));
END LOOP;
END;
Thanks,
Rupa
|
|
|
Goto Forum:
Current Time: Sat Feb 01 00:04:48 CST 2025
|