EasyUI Forum

General Category => General Discussion => Topic started by: Spike on November 26, 2014, 04:21:12 AM



Title: Difference between addRow and appendRow edatagrid
Post by: Spike on November 26, 2014, 04:21:12 AM
Hello,

I have a question concerning appendRow en addRow in a edatagrid.

appendRow is not working;

addRow works fine. But why are there two methods to add a record?
(and what is the difference with insert?)

THIS CODE WORKS WELL;

 $('#dg_hvs').edatagrid('addRow',{
   boekjaar             : 14,
   dossiernummer         : '98765'
});
                  
$('#dg_hvs').datagrid('saveRow');  //


THIS CODE WORKS NOT BUT

 $('#dg_hvs').edatagrid('appendRow',{
   boekjaar             : 14,
   dossiernummer         : '98765'
});


Thanks in advance for your help.

Spike






Title: Re: Difference between addRow and appendRow edatagrid
Post by: stworthy on November 26, 2014, 07:36:25 AM
Calling 'appendRow' method can only append a row to the end of rows. This appended row is not editable. When calling 'addRow' method to add a new row, the added row is editable. The 'addRow' method also allows the user to insert a new row to any position.
Code:
// append an empty row
$('#dg').edatagrid('addRow');

// append an empty row as first row
$('#dg').edatagrid('addRow',0);

// insert a row with default values
$('#dg').edatagrid('addRow',{
index: 2,
row:{
name:'name1',
addr:'addr1'
}
});


Title: Re: Difference between addRow and appendRow edatagrid
Post by: Spike on November 26, 2014, 07:52:11 AM
Ok Thanks. It's clear for me now! ;D