EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rabesh on November 11, 2012, 03:45:19 AM



Title: Disable drag and drop in datagrid
Post by: rabesh on November 11, 2012, 03:45:19 AM
Helloo,
 i had used drag and drop using jeasyui plugins(datagrid-patch.js ,datagrid-dnd.js) which you send to me.
It has facility to enable dnd but i need disable dnd as like in tree.
But i am not able to find disable dnd.

Can you help me for that?

Thanks


Title: Re: Disable drag and drop in datagrid
Post by: stworthy on November 11, 2012, 05:25:03 PM
The 'disableDnd' method is not provided in datagrid-dnd.js file, but extending it is easily.
Code:
$.extend($.fn.datagrid.methods,{
disableDnd: function(jq,index){
return jq.each(function(){
var target = this;
var opts = $(this).datagrid('options');
if (index != undefined){
var trs = opts.finder.getTr(this, index);
} else {
var trs = opts.finder.getTr(this, 0, 'allbody');
}
trs.draggable('disable');
});
}
});


Title: Re: Disable drag and drop in datagrid
Post by: rabesh on December 03, 2012, 12:48:43 AM
I added following code in datagrid-dnd.js file

disableDnd: function(){
         return
            trs.draggable({
               disabled: true,
               revert: true,
               cursor: 'pointer'
                })
        },


And It works Fine