我无法在jQuery EasyUI可编辑数据网格中添加新记录

时间:2014-02-05 11:06:30

标签: jquery jquery-ui datagrid

我使用jQuery EasyUI可编辑数据网格来显示来自mySQL数据库的数据。 在表的顶部是一个按钮工具栏,用于在tablegrid中添加新行。 我第一次单击该按钮时,只显示一个新行,但我无法添加任何新数据。 当我再次单击该按钮时,会出现第二行,现在我可以按原样输入数据。

我该如何避免这种情况?

按钮的代码是:

<a id="<?php print $toolbar_id; ?>_btn_1" 
    href="javascript:void(0)" 
    class="easyui-linkbutton" 
    iconCls="icon-add" 
    plain="true" 
    onclick="javascript:$('#<?php print $grid_id;?>').edatagrid('addRow',{ index: 2, row:{mid:'1'} })" 
    disabled="true">
        Actie toevoegen
</a> 

在父tablegrid中选择行时启用该按钮。

更新

<div id="actieplan">
    <h2>Actieplan</h2>
    <p style="margin-left: 20px; font-style: italic;"><?php $l->__('geen melding geselecteerd');?></p>
    <table id="<?php print $grid_id;?>"           
           title="Acties" 
           style="height:auto;"
           toolbar="#<?php print $toolbar_id; ?>" 
           >
        <thead>
            <tr>
                <th field="id" sortable="true" >#</th>
                <th field="melding_id" width="10" sortable="true" hidden>#bom</th>
                <th field="human_datum" width="40" editor="{type:'datebox',options:{
                    required:true}
                    }" sortable="true">Datum</th>
                <th field="human_datum_start" width="40" editor="{type:'datebox',options:{required:false}}" sortable="true">Startdatum</th>
                <th field="human_datum_eind" width="40" editor="{type:'datebox',options:{required:false}}" sortable="true">Einddatum</th>
                <th field="actie" width="200" editor="{type:'validatebox',options:{required:true}}">Actie</th>

                <th field="uitvoerder_naam" width="100" editor="{
                    type:'combobox', options:{
                        required:true,
                        url:'./model/actie/lst_uitvoerders_acties.php',
                        valueField:'uitvoerder_naam',
                        textField: 'uitvoerder_naam',
                        panelHeight:'auto'}
                    }" sortable="true">Uitvoerder</th>
                <th field="status_id" width="50" editor="{type:'combobox', options:{
                        required:true,
                        url:'./model/status/lst_status.php',
                        valueField:'id',
                        textField:'status',
                        panelHeight:'auto'}
                    }" sortable="true">Status</th>
            </tr>
        </thead>
    </table>

0 个答案:

没有答案