EasyUI Forum
September 13, 2025, 12:06:54 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: How to disable drags and drops within treegrid?  (Read 9291 times)
alastairwalker
Newbie
*
Posts: 14


View Profile Email
« on: August 16, 2014, 08:39:53 AM »

I am trying out the example in http://www.jeasyui.com/extension/treegrid_dnd.php for d and d between the treegrid and datagrid.

The functionality I need must disable the d and d within the treegrid.

I want to restrict the functionality to:
a) select a row from the treegrid;
b) to only allow a drop on the datagrid.

How do I go about this?

I searched the posts, but could not locate how to do this.

Many thanks in anticipation..

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


View Profile Email
« Reply #1 on: August 17, 2014, 06:02:10 AM »

To disable dropping nodes on the treegrid, please try the code below:
Code:
$('#tg').treegrid({
onDragEnter: function(targetRow,sourceRow){
var opts = $(this).treegrid('options');
var tr = opts.finder.getTr(this, targetRow[opts.idField]);
if (tr.attr('node-id')){
return false;
}
}
})
Logged
alastairwalker
Newbie
*
Posts: 14


View Profile Email
« Reply #2 on: August 18, 2014, 05:36:33 AM »

Many thanks!

For the record, this is the script I had to actually use:

$(function(){$('#tg').treegrid({onDragEnter: function(targetRow,sourceRow)
   {
   var opts = $(this).treegrid('options');
   var tr = opts.finder.getTr(this, targetRow[opts.idField]);
   if (tr.attr('node-id')){return false;}
   }})
});

(Note: the parentheses were unbalanced.)

Alastair

 
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!