EasyUI Forum
December 12, 2025, 04:21:54 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to reload async tree  (Read 23818 times)
azizkhani
Newbie
*
Posts: 37


View Profile Email
« on: January 02, 2015, 08:08:48 AM »

i use tree in async ,
after user add new node to tree i want to reload parent node again and fetch data from server.
how can do it?
plz
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 02, 2015, 08:36:02 AM »

Please pass the parent node element to the 'reload' method.
Code:
var p = ...  // get your parent node
$('#tt').tree('reload', p.target);  // reload the parent node
Logged
azizkhani
Newbie
*
Posts: 37


View Profile Email
« Reply #2 on: January 03, 2015, 08:36:48 AM »

Please pass the parent node element to the 'reload' method.
Code:
var p = ...  // get your parent node
$('#tt').tree('reload', p.target);  // reload the parent node

when node state in open it is not work
i change state to closed and reload but again not work
var selectedNode = $('#tree').tree('getSelected');
$('#tree').tree('update', {
   target: selectedNode.target,
   state: 'closed'
});
$('#tree').tree('reload',selectedNode.target);

 Huh Huh Huh
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: January 03, 2015, 08:37:16 PM »

Please open this example http://www.jeasyui.com/tutorial/tree/tree2_demo.html and then run the code below in your browser's console.
Code:
$('#tt').tree('reload',$('#tt').tree('getRoot').target);

You will see the root node is reloaded successfully.
Logged
azizkhani
Newbie
*
Posts: 37


View Profile Email
« Reply #4 on: January 04, 2015, 07:35:32 AM »

Please open this example http://www.jeasyui.com/tutorial/tree/tree2_demo.html and then run the code below in your browser's console.
Code:
$('#tt').tree('reload',$('#tt').tree('getRoot').target);

You will see the root node is reloaded successfully.


yes root node is reloaded but if you add new node to node 2 in this page and want to reload node 2 to show children it is not work
because state is open ;
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: January 04, 2015, 09:21:13 AM »

Please notice that you are loading tree nodes from remote server. If you call 'append' method to append tree nodes. These appended nodes will not be saved to your server. You must do some saving action to let the server return the correct data back to the browser.
Logged
azizkhani
Newbie
*
Posts: 37


View Profile Email
« Reply #6 on: January 05, 2015, 07:28:10 AM »

Please notice that you are loading tree nodes from remote server. If you call 'append' method to append tree nodes. These appended nodes will not be saved to your server. You must do some saving action to let the server return the correct data back to the browser.


that is right
 i add node in remote server (ajax ) and want reload just this node to see children,i will not reload root node because
1)my tree have more than 200,000 record  and it is bad performance
2)it is not good   for user that add node to level 3 and root node refresh and user will again open root again open level 2 to see node that create from client Huh Huh Huh Huh
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #7 on: January 05, 2015, 08:59:57 AM »

How do you add new nodes to the tree? In fact you can call 'append' method to append new nodes to a specified node and then post these added nodes to your server. At any time you also can call 'reload' method to refresh the children nodes of a parent node.

If your issue continues, please provide an example or a link page to demonstrate your issue.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!