EasyUI Forum

General Category => Bug Report => Topic started by: jpierce on October 30, 2013, 02:11:41 PM



Title: deleteRow causes expand problems
Post by: jpierce 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.


Title: Re: deleteRow causes expand problems
Post by: jpierce 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.


Title: Re: deleteRow causes expand problems
Post by: stworthy on October 30, 2013, 07:19:24 PM
Yes, these examples have been updated to use 'getRowDetail' method.