EasyUI Forum
November 05, 2025, 12:51:03 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: Big Problem about tree  (Read 12503 times)
nyr_jack
Newbie
*
Posts: 31


View Profile
« on: October 29, 2012, 01:26:30 AM »

Codes:

html:
<ul id="basicTree" class="easyui-tree" style="height:200px;" data-options="url:'data/tree_data.json',checkbox:true,lines:true"></ul>
<ul id="targetTree" class="easyui-tree" style="height:200px;" data-options="checkbox:true,lines:true"></ul>

javascripts:

var checkedNodes = $('#basicTree').tree('getChecked');

for(var i = 0; i < checkedNodes.length; i++){
  //append every checked node to targetTree
/*
 parentNode = $('#basicTree').tree('getParent',checkedNodes.target);
 var t_node = $('#targetTree').tree('find',parentNode.id);
first problem is: there is no parent node of checkedNodes in targetTree, but when I use find method in targetTree , it can return node, it is wrong, how to solve?
*/
/*
$('#targetTree').tree('append',{
   parent:parentNode.target,
   data:[{
      id:checkedNodes.id,
      text:checkedNodes.text
   }]
});

it don't append this node to targetTree, but it append to basicTree.   
*/
}
Please help me ,it's hurry!
Logged
nyr_jack
Newbie
*
Posts: 31


View Profile
« Reply #1 on: October 29, 2012, 01:41:44 AM »

other question:

How to specify the parent node of a leaf node of basicTree ,and first append parent node to targetTree , and then append leaf node to targetTree??
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: October 29, 2012, 02:27:55 AM »

Please refer to the sample below:
http://jsfiddle.net/jW4ST/
Select a node from the top tree and then click the 'append' link below to append nodes to the bottom tree.
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!