EasyUI Forum
May 13, 2024, 03:49:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Is it possible to add Ondrag, OndragStart, OndragStop event to 'tree' structure?  (Read 20010 times)
shrikantphale
Newbie
*
Posts: 4


View Profile Email
« on: September 26, 2012, 04:15:34 AM »

I want these events to validate whether to allow that particular node to drop or not... plz help...
thanks..
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 26, 2012, 11:55:09 AM »

Get a tree node and call 'enable' and 'disable' methods provided in draggable to determine if the node can be draggable.

Code:
var node = $('#tt').tree('find', 12);  //find a node
$(node.target).draggable('disable');
$(node.target).draggable('enable');
Logged
shrikantphale
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: September 28, 2012, 03:20:09 AM »

Hey... do you have any solution to restrict any node to move away from its parent... and also restrict node to go into any node... in drag drop feature in tree... plz help ASAP....
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: September 28, 2012, 06:39:24 PM »

The 'onDragOver' event is available from http://www.jeasyui.com/easyui/plugins/jquery.tree.js. Some codes looks like this:
Code:
$('#tt').tree({
dnd: true,
onDragOver: function(target, source){
var cc = $(this).tree('getChildren',target);
for(var i=0; i<cc.length; i++){
if (cc[i].target == source.target){return false} // return false to deny drop, restrict the node to move away from it parent
}
}
});
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!