1.grid的input中回车切换到下一行的同一列并选中已有内容
grid的input中回车切换到下一行的同一列的实现可以参考http://docs.wex5.com/bex5-grid-10013/
切换到input中并选中已有内容可以在上面实现grid.editcell做如何调整
Model.prototype.input1Keydown = function(event) {
var data = this.comp("bizData1");
var grid = this.comp("grid1");
var count = data.getCount();
var rowindex = data.getRowIndex() + 1;
if (event.keyCode == 13) {
grid.editStop();
if (rowindex < count) {
data.next();
rowid = data.getCurrentRowID();
var cell = grid.getCell(rowid, "fName")
grid.editCell(cell);
$(cell).find("input").bind("focus",function(){this.select();});
}
}
};
2.平台默认的回车键切换到下一个单元格选中已有内容
要修改平台的默认实现,需要修平台的js文件/UI2/system/components/justep/grid/grid.js
在js文件中找打editCell的实现,然后最后的
//如果只有一个节点默认进入,可以考虑优化成进入input、textarea、select等组件
if($cell.children().size()===1) $cell.children().addClass('x-edit-focusin');
$cell.on('keydown',this._eventHandles['cell_edit_keydown']).find('.x-edit-focusin').focus();
return true;
如下修改:
$(cell).find("input").bind("focus",function(){this.select();});
//如果只有一个节点默认进入,可以考虑优化成进入input、textarea、select等组件
if($cell.children().size()===1) $cell.children().addClass('x-edit-focusin');
$cell.on('keydown',this._eventHandles['cell_edit_keydown']).find('.x-edit-focusin').focus();
$(cell).find("input").bind("focus",function(){this.select();});
如何是修改的js文件生效参考http://docs.wex5.com/bex5-ui-question-list-10013/
评一波