jquery easyui 中的datagrid中的数据是动态的从服务器获取并绑定到datagrid的。并且datagird有3个toolbar 。 且可以编辑。现在我在datagrid的前一个控件中按“tab”键会将焦点跳到datagrid的第一个toolbar上,我现在要求将焦点跳到datagrid的当前编辑行的第一个控件上。如何处理呢?

解决方案 »

  1.   

    jquery easyui 中的datagrid中的数据是动态绑定的。且可编辑。如何设置焦点到其当前编辑行的元素?
      

  2.   

     $('#test').datagrid('getEditor', {index:rowIndex, field:'name'}).target.focus()
    rowIndex为当前编辑行号
    name为当前行的列属性名
      

  3.   

    <table id="goods" style="width: 360px;height:130px;overflow: hidden; float: left; margin: 0px; padding: 0px; " 
                        iconcls="icon-edit;" singleSelect="true" idField="gseq">
                            <thead>
                                <tr>
                                    <th field="gtname" width="100" editor="{type:'combobox',options:{valueField:'GTSEQ',textField:'GTNAME',url:'GoodType/GetGoodsType'}}" >
                                    品名
                                </th>
                                <th field="bzname" width="80" editor="{type:'combobox',options:{valueField:'BZSEQ',textField:'BZNAME',url:'BaoZhuang/GetBaoZhuang'}}">
                                    包装
                                </th>
                                <th field="goodsnum" width="80" editor="numberbox" >
                                    件数
                                </th>
                                <th field="tprice" width="100"  editor="numberbox">
                                    金额
                                </th>
                                </tr>
                            </thead>
                        </table>我要焦点定位到第一行的第一个单元格的下拉框。怎么做呢?