unidbgrid按回车键切换到右侧CELL
作者:互联网
打开UniDBGrid的ClientEvents->ExtEvents属性,编辑Ext.grid.Panel的reconfig函数,输入如下代码就可以实现当UniDBGrid表格的ReadOnly属性为false、Options->dgRowSelect为false、Options->dgRowNumbers为false时(只要原表格的数据列,不带行号和勾选框等),按回车键就可以让光标横向切换表格列,到最后一列时将自动切换到下一条记录的第一列。
function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { var grid = sender; function fn() { var selModel = grid.getSelectionModel(); var _row = selModel.getCurrentPosition().row; var _col = selModel.getCurrentPosition().column; if (grid.columnManager.columns[_col].isLastVisible) { _col = 0; _row += 1; } else { _col += 1; }; setTimeout(function() { grid.getSelectionModel().select({ row: _row, column: _col }); grid.editingPlugin.startEdit(_row, _col); }, 10); }; for (var i = 0; i < columns.length; i++) { var hasEditor = columns[i].getEditor(); var ed = hasEditor || columns[i]; if (columns[i].checkColumn) { columns[i].on('keydown', function(a, b, c, d, e) { if (e.getKey() == 13) { fn(); } }) } else if (columns[i].rdonly) { ed.on('keydown', function(a, b, c, d, e) { if (e.getKey() == 13) { fn() } }) } else { ed.on('specialkey', function(field, e) { if (e.getKey() == 13) { fn(); } }) } } }
标签:function,CELL,grid,unidbgrid,var,回车键,col,columns,row 来源: https://www.cnblogs.com/AkumaIII/p/12180359.html