在ext2.2的可编辑grid中,unfocus一个cell之后,grid的滚动条会自动向右滚动,造成页面混乱
解决方法:
在ext-all-debug.js中,找到EditorGridPannel部分代码,注释或者重写focusCell方法
// private
onEditComplete : function(ed, value, startValue){
this.editing = false;
this.activeEditor = null;
ed.un("specialkey", this.selModel.onEditorKey, this.selModel);
var r = ed.record;
var field = this.colModel.getDataIndex(ed.col);
value = this.postEditValue(value, startValue, r, field);
if(String(value) !== String(startValue)){
var e = {
grid: this,
record: r,
field: field,
originalValue: startValue,
value: value,
row: ed.row,
column: ed.col,
cancel:false
};
if(this.fireEvent("validateedit", e) !== false && !e.cancel){
r.set(field, e.value);
delete e.cancel;
this.fireEvent("afteredit", e);
}
}
/*this.view.focusCell(ed.row, ed.col); */
},
在ext-all.js中,按下面方法注释掉focusCell方法
delete g.cancel;this.fireEvent("afteredit",g)}}/*this.view.focusCell(b.row,b.col)*/
本文介绍如何解决ExtJS 2.2版本中编辑型Grid的一个bug:当取消聚焦单元格后,Grid滚动条自动右移导致页面布局错乱。通过修改源代码中的focusCell方法来解决该问题。
6282

被折叠的 条评论
为什么被折叠?



