EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: binte.hava on March 07, 2014, 06:33:10 AM



Title: ADD 10 Blank Rows in edatagrid
Post by: binte.hava on March 07, 2014, 06:33:10 AM
Hi!
I have a button and i want to add 10 Blank rows in the edatagrid. right now the code that i m using add only one row.

<table id="dgsv_admin" title="WORKSHEET" style="width:950px; height:460px;"
         toolbar="#toolbar" pagination="false" idField="id"
         rownumbers="false" fitColumns="false" singleSelect="true">
   
      <thead>
         <tr>
            <th field="code" width="62" editor="{type:'validatebox',options:{required:true}}">Code</th>
            <th field="type" width="64" editor="{type:'validatebox',options:{required:true}}">Type</th>
                         </tr>
               </thead>
</table>

Here is the code to add Rows to the above grid:

<button class="btn btn-success" onClick="javascript:$('#dgsv_admin').edatagrid('addRow')">ADD 10 ROWS</button>

Any solution regarding this....?


Title: Re: ADD 10 Blank Rows in edatagrid
Post by: stworthy on March 07, 2014, 08:26:28 PM
To append a row for editing, try this:
Code:
$('#dg').edatagrid('addRow');

To append a row and save it, try this:
Code:
$('#dg').edatagrid('addRow', {row:{...}}).edatagrid('saveRow');