EasyUI Forum
May 16, 2024, 04:28:56 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: [SOLVED] Drag/Drop and onBeforeLoad  (Read 10813 times)
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« on: April 13, 2016, 07:30:23 AM »

Hello
I have this code::

Code:
	<script type="text/javascript">
var data = [{... some data}]
   function    loadData(){
    $('#aa').treegrid('loadData',data);  
   }
</script>
                
  <!-- Load data button -->
  <a href="#" onclick="loadData();" class="easyui-linkbutton" >Load</a>

<table id="aa" title="Folder Browser" class="easyui-treegrid" style="width:400px;height:400px"
data-options="
animate: true,
idField: 'id',
treeField: 'name',
onBeforeLoad: function(row,data){
$(this).treegrid('enableDnd', row?row.id:null);
}
">
<thead>
<tr>
<th data-options="field:'name'" width="80%">Name</th>
<th data-options="field:'size'" width="10%" align="right">Size</th>
<th data-options="field:'date'" width="10%">Modified Date</th>
</tr>
</thead>
</table>


when I click on "Load" button, data is loaded, but Drag/Drop does not work.
When I use onLoadSuccess instead of onBeforeLoad, it works but then I can not drop on empty treegrid.
Any solution for this - to be able to drop on empty treegrid and to use enableDnd ?
Thank you
« Last Edit: April 14, 2016, 09:25:46 AM by Pierre » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: April 13, 2016, 08:32:04 AM »

You need to call 'enableDnd' method after creating the empty treegrid, or call this method again after loading data successfully. Please look at this code.
Code:
$('#aa').treegrid({
onLoadSuccess: function(){
$(this).treegrid('enableDnd');
}
});
$('#aa').treegrid('enableDnd');
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #2 on: April 13, 2016, 09:53:59 AM »

OK solved that, I did not called 'enableDnd' after data loaded, thank you for that, but there is some bug - I attached complete code and image, please do this:
1. Click on Load button to load both treegrid's
2. Click on 'bbb' Tab
3. Click on ** ALL ** record and drag it to 'java.exe' and drop it there.. Where is the record? You can see it if you click on tab 'aaa' - it is there, as last record ...
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: April 14, 2016, 12:15:32 AM »

Please try to download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.5-patch.zip.
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #4 on: April 14, 2016, 12:18:54 AM »

Hello
just found another bug (it can be reproduced on same source I send in previous post):
1. Click on Load button
2. Select Tab 'bbb'
3. Click once on 'java.exe' (see image below)
4. Click on ***ALL*** record and drag it over 'java.exe' - you will see it is not possible to drop it on 'java.exe'
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #5 on: April 14, 2016, 12:22:24 AM »


Awesome, this works great, but in the meantime I posted new reply (regarding click on item).
Thank you!
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #6 on: April 14, 2016, 08:12:51 AM »

Please download the updated 'treegrid-dnd.js' file from http://www.jeasyui.com/extension/treegrid_dnd.php
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #7 on: April 14, 2016, 09:25:27 AM »

Thank you so much, it works perfect.
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!