EasyUI Forum
May 15, 2024, 11:33:56 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: Textbox to Grid  (Read 6849 times)
mendozada
Newbie
*
Posts: 9


View Profile
« on: February 17, 2016, 07:15:28 AM »

Hello, I'm probably asking is very obvious, but turn to you and I'm stuck and do not know how without having to make a connection to the database

I have 3 textbox at the touch of a buttonlink should complete them fill the grid.


my code
Code:
<table>
<TR>
<TD>Fecha/Periodo</TD>
<TD>Empresa</TD>
<TD>Puesto/Oficio</TD>
</TR>
<TR>
<TD>
<input name="ExpPeriodo" class="easyui-textbox" style="width:100px">
</TD>
<TD>
<input name="ExpEmpresa" class="easyui-textbox" style="width:200px">
</TD>
<td>
<input name="ExpPuesto" class="easyui-textbox" style="width:200px">
</td>
<td>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" onclick="CargaExpLab()"></a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" ></a>
</td>
</tr>
</table>
<table id="ExLab" class="easyui-datagrid" style="width:650px;height:250px" data-options="rownumbers:true,singleSelect:true,url:'ExpLabo.json',method:'get'">
        <thead>
            <tr>
                <th data-options="field:'ck',checkbox:true"></th>
                <th data-options="field:'Fecha',width:100">Fecha/Periodo</th>
                <th data-options="field:'Empresa',width:250">Empresa</th>
                <th data-options="field:'Puesto',width:250">Puesto/Oficio</th>
            </tr>
        </thead>
    </table>

I try insert  Fecha: '01', Empresa:'SAAM',    Puesto: 'name01', but i can't.

Code:
function CargaExpLab(){
$('#ExLab').datagrid('load',{
Fecha: '01',
Empresa:'SAAM',
Puesto: 'name01'
});
}

Thank
« Last Edit: February 17, 2016, 01:32:07 PM by mendozada » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: February 18, 2016, 08:11:41 AM »

To insert data into the datagrid, you need to call 'appendRow' or 'insertRow' method instead.
Code:
$('#ExLab').datagrid('appendRow', {
  Fecha: '01',
  Empresa:'SAAM',
  Puesto: 'name01'
});
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!