EasyUI Forum
May 19, 2024, 09:22:53 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: Datagrid drag and drop didn't trigger onLoadSuccess  (Read 9790 times)
James
Jr. Member
**
Posts: 52


View Profile Email
« on: November 16, 2015, 01:27:36 AM »

Datagrid drag and drop didn't trigger onLoadSuccess
But Treegrid after drag and drop , onLoadSuccess works
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: November 16, 2015, 08:46:54 AM »

The 'onLoadSuccess' event should not be triggered when drop a node, please use the 'onDrop' event instead. The 'treegrid-dnd.js' file can be downloaded from http://www.jeasyui.com/extension/treegrid_dnd.php
Logged
James
Jr. Member
**
Posts: 52


View Profile Email
« Reply #2 on: November 18, 2015, 08:24:05 PM »

The 'onLoadSuccess' event should not be triggered when drop a node, please use the 'onDrop' event instead. The 'treegrid-dnd.js' file can be downloaded from http://www.jeasyui.com/extension/treegrid_dnd.php

That's not true. Just try add "console.info('dnd');" to treegrid dnd demo's "onLoadSuccess" function,

http://www.jeasyui.com/extension/downloads/treegrid-dnd.zip

You will find it triggered every time when leaf is droped,

But if you add the same code to datagrid dnd , it will not work as the same way treegrid do.

http://www.jeasyui.com/extension/downloads/datagrid-dnd.zip

In my app, I need to change the display of data after data loaded (can't use formatter, because I need to add params), so I put some code into onLoadSuccess to do the work. treegrid-dnd triggered "onLoadSuccess" every time when data is droped, but datagird did't do it , I don't konw what to do now , I really need it works.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: November 18, 2015, 11:44:46 PM »

Please use the 'onDrop' event instead.
Code:
$('#dg').datagrid({
onLoadSuccess:function(){
$(this).datagrid('enableDnd');
},
onDrop: function(destRow, sourceRow, point){
console.log('drop ' + sourceRow.itemid + ' on ' + destRow.itemid);
}       
})
Logged
James
Jr. Member
**
Posts: 52


View Profile Email
« Reply #4 on: November 19, 2015, 12:42:56 AM »

Please use the 'onDrop' event instead.
Code:
$('#dg').datagrid({
onLoadSuccess:function(){
$(this).datagrid('enableDnd');
},
onDrop: function(destRow, sourceRow, point){
console.log('drop ' + sourceRow.itemid + ' on ' + destRow.itemid);
}       
})

if use onDrop instead , that means I should copy the code to onLoadSuccess and onDrop both
Code:
$('#dg').datagrid({
onLoadSuccess:function(){
$(this).datagrid('enableDnd');
                //do something
},
onDrop: function(destRow, sourceRow, point){
//do something
}       
})
while treegrid just need
Code:
$('#dg').treegrid({
onLoadSuccess:function(){
$(this).treegrid('enableDnd');
                //do something
}     
})
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!