EasyUI Forum

General Category => General Discussion => Topic started by: thiago_brum on May 31, 2016, 05:56:06 AM



Title: eDataGrid destroyRow Error
Post by: thiago_brum on May 31, 2016, 05:56:06 AM
I have a eDataGrid ...

     <table id="datagrid_item_pedido" title="Itens" idField="id" singleSelect="true">
        <thead>
           <tr>
      <th field="action" width="18" data-options="formatter:function(value,row,index){ return '<a href=\'#\' onclick=\'deleteLine()\'>Delete</a>';}"></th>
      <th field="cod_item" width="100">Item</th>
           </tr>
        </thead>
     </table>


  $('#datagrid_item_pedido').edatagrid({
  });

  function deleteLine(){
     var row = $('#datagrid_item_pedido').datagrid('getSelected');
     var index = $('#datagrid_item_pedido').datagrid('getRowIndex',row);
     $('#datagrid_item_pedido').edatagrid('destroyRow',index);
  }

I insert two lines in eDataGrid ...

$('#datagrid_item_pedido').edatagrid('addRow',{row:{cod_item:'Test1'}});
$('#datagrid_item_pedido').edatagrid('addRow',{row:{cod_item:'Test2'}});

If i click on the link "Delete" in the first line ("Test1"), the line disappears (it's ok).
Now, if I click again on "Delete" link on the left line ("Test2"), nothing happens.
Can someone help me with this problem?


Title: Re: eDataGrid destroyRow Error
Post by: stworthy on May 31, 2016, 07:50:39 PM
Please try to download the newest 'jquery.edatagrid.js' file from http://www.jeasyui.com/extension/edatagrid.php