当一个页面有多个结构相同的Ext.grid.EditorGridPanel时,我们可能定义一个列信息,
var columns = [{},{},{}...]; // 1、这里指定不指定editor,
然后多次使用这个数组初始化各个Grid的ColumnModel:
var cm = new new Ext.grid.ColumnModel(columns);
//2、 或是这里再指定editor,现象都一样。
然后就会出现某个Grid的某个列第一次编辑以后,其他Grid的此列都不能编辑了。
说明columns数组或是其中的各个对象被共享了。
翻开3.0源码一看,果然,直接在setConfig方法中this.config = config了,(ps:发现创建editor的代码在source中的和ext-all-debug.js中的代码是不一致的。)。
将这个几句代码稍微改改,不直接用config就可以实现共用了。
Ext.grid.ColumnModel.prototype.setConfig =function(config, initial){
if(!initial){ delete this.totalWidth;
for(var i = 0, len = this.config.length; i < len; i++){
var c = this.config[i];
if(c.editor){
c.editor.destroy();
}
}
}
this.config = [];
this.lookup = {};
for(var i = 0, len = config.length; i < len; i++){
var col = Ext.apply({},config[i]);
this.config.push(col);
var c = Ext.applyIf(col, this.defaults);
if(typeof c.renderer == "string"){
c.renderer = Ext.util.Format[c.renderer];
}
if(typeof c.id == "undefined"){
c.id = i;
}
if(c.editor && c.editor.isFormField){
c.editor = new Ext.grid.GridEditor(c.editor);
}
this.lookup[c.id] = c;
}
if(!initial){
this.fireEvent('configchange', this);
}
}
分享到:
相关推荐
此文档是可编辑表格Ext.grid.EditorGridPanel的说明以及示例的源代码,放到eclipse里面即可运行,显示出效果!
EXT核心API详解 1、Ext类 ………………………………… 2 2、Array类 …………………………… 4 ...编码一个对象/数组或其它值为一个json格式字符串(支持对象,数组,日期,字符串) destroy( Mixed arg1, Mixed (optiona
右键菜单的资料,代码已经详细描写。请仿照文件中所描述即可使用,不限于EXT4.0以上版本使用。
1、Ext类 ………………………………… 2 2、Array类 …………………………… 4 3、Number类 …………………………… 4 4、...73、Ext.grid.EditorGridPanel类 ……… 62 74、Ext.grid.PropertyGrid类 …………… 65
NULL 博文链接:https://tonylian.iteye.com/blog/1735525
ext 数据对象的定义 EditorGridPanel的使用 ext读取xml ext对各种数据格式的支持
1.界面修改(css style): Extjs中界面风格与我们产品本身的风格有很大不同,从边框、... 属性的作用(About Ext.grid. GroupingView, EditorGridPanel): Extjs的grid功能强大,如排序、隐藏列或移动列等,这些都有一些属
为了解决这个问题需要在EditorGridPanel的ColumnModel中显示ComboBox的地方使用renderer属性,重新渲染,方法如下: 代码如下: //部门列表 var comboxDepartmentStore = new Ext.data.Store({ proxy: new Ext.data....
详细介绍GridPanel各项属性,ExtJS 普通表格:Ext.grid.GridPanel属性详解
因为前段时间有两个专案要用到extjs技术,所以自己学了一段...grid,tree,显示树信息的TreePanel、用于显示表格的GridPanel及EditorGridPanel,还有代表应用程序窗口的Ext.Window,与数据库交付,希望对初学者带来帮助
我这是根据别人写的做成PDF文档 第一章 开始ExtJS………………………………………………………………………………………………………4 1.1 获得ExtJS……………………………………………………………………...