Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

easyui datagrid获取editor始终为null

easyui datagrid中使用的可以编辑的datagrid,调用$("#dg").datagrid("getEditors",rowIndex),获取到的的Editor之中为NULL 代码如下:

    <table id="dg" class="easyui-datagrid" data-options="singleSelect:true,fitColumns:true,onClickRow:onClickRow">
    <thead>
        <tr>
           <th field="id">商品编号</th> 
           <th field="amount" data-options="editor:{type:'numberbox'}">数量</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>20176537</td>
            <td>17</td>
        </tr>
        <tr>
            <td>201765373</td>
            <td>11</td>
        </tr>
    </tbody>

    </table>
    <script type="text/javascript">
        function onClickRow(rowIndex, rowData){
             alert(rowIndex);
             var editors = $("#dg").datagrid('getEditors',rowIndex);
             alert(editors.length);
            }//在这里使用获取到的长度为0
    </script>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你在click中,当前行并没有处于编辑模式,当然是null


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...