EasyUI Forum
October 18, 2025, 06:35:18 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: deleteRow causes expand problems  (Read 14482 times)
jpierce
Jr. Member
**
Posts: 73


View Profile
« on: October 30, 2013, 02:11:41 PM »

Bit of a logic bug in the way the master-detail stuff is implemented.  

Go to
http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=
and click on the Master Detail example.  then in the console, issue:
Code:
$('#dg').datagrid('deleteRow', 0)
Now click to expand the first row.  You get a blank line.

The problem is that onExpandRow looks like this:
Code:
onExpandRow: function(index,row){
    $('#ddv-'+index).panel({

Meaning it always fetches the element with the id ddv-0 for the first row.  But when you call deleteRow, it removes the row as well as the ddv-0 item that goes with it.  It then never changes the rest of the rows so that now the row indexes don't match what the detail row placeholder ids.
« Last Edit: October 30, 2013, 02:49:15 PM by jpierce » Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #1 on: October 30, 2013, 02:48:55 PM »

My workaround for that example:

Code:
onExpandRow: function(index,row){
    //$('#ddv-'+index).panel({
    $(this).datagrid('getRowDetail', index).panel({
        height:80,
        border:false,
        cache:false,
        href:'datagrid21_getdetail.php?itemid='+row.itemid,
        onLoad:function(){
            $('#dg').datagrid('fixDetailRowHeight',index);
        }
}

Maybe not using getRowDetail was an oversight in that example.  But I've either followed that example or code posted here for implementing my detail, and it didn't use getRowDetail.  Seems like a good time to update the example.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #2 on: October 30, 2013, 07:19:24 PM »

Yes, these examples have been updated to use 'getRowDetail' method.
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!