+ -
当前位置:首页 → 问答吧 → ext 可编辑表格获取焦点的问题

ext 可编辑表格获取焦点的问题

时间:2010-12-23

来源:互联网

现在项目中用的是可编辑表格,输入一个数据就保存,如何再数据保存成功后按下回车键自动跳到下一个单元格
JScript code

listeners: {
               "afteredit": function(e) {
                   var grid = Ext.getCmp('ordergrid');
                   var r = e.record; //得到当前行所有数据
                   var f = e.field; //得到修改列
                   var v = e.value; //得到修改列修改后值
                  // alert(v);
                 
                   //通过ajax请求修改数据
                   Ext.Ajax.request({
                       url: "updateSurface.action",
                       method: "POST",
                       params: {
                           fieldName: f,
                           fieldValue: v,
                           ID: r.data.id
                       },
                       success: function(r) {
                           grid.getStore().reload(); 
                      grid.getSelectionModel().selectRow(0,false);// 
                           grid.getView().focusCell(0,0); //选中的获取焦点 


                       },
                       failure: function() {
                           MessageBox("提示", "操作失败!", Ext.MessageBox.ERROR);
                           grid.getStore().reload();
                       }
                   });
               }
           }
                    

作者: angel21li   发布时间: 2010-12-23

大家帮帮忙!不知道怎么解决!

作者: angel21li   发布时间: 2010-12-24

grid.getView().focusCell(0,0); //选中的获取焦点 
你试一下
focusCell(e.row ,e.column + 1 ); 

afteredit : ( Object e ) 
Fires after a cell is edited. The edit event object has the following properties <br /> <ul style="padding:5px;paddin...
Fires after a cell is edited. The edit event object has the following properties 

grid - This grid
record - The record being edited
field - The field name being edited
value - The value being set
originalValue - The original value for the field, before the edit.
row - The grid row index
column - The grid column index

作者: didiaodezhu   发布时间: 2010-12-24

热门下载

更多