extjs 3.4 实现EditorGridPanel不同行同一列显示不同的Editor

需求:想在EditorGridPanel的不同行的同一列显示不同的编辑器

代码:

方法一:

this.grid.on("cellclick",function(grid,rowIndex,colIndex,e){

var  innerName = grid.store.getAt(rowIndex).data.innerName;

var column = grid.getColumnModel().columns[colIndex];

if(innerName=="startTime"){

this.startTime = new Ext.form.DateField({

format:'Y-m-d',

name:'startTime',

readOnly:false,

minValue:new Date()

});

column.setEditor(this.startTime);

}

if(innerName=="home"){

this.home = new Ext.form.TextField({

省略

});

column.setEditor(this.home);

}

});


方法二:

this.grid.getColumnModel().getCellEditor=function(colIndex,rowIndex){

var  innerName = Ext.getCmp("grid").getStore().getAt(rowIndex).data.innerName;

if(innerName=="startTime"){

this.startTime = new Ext.form.DateField({

format:'Y-m-d',

name:'startTime',

readOnly:false,

minValue:new Date()

});

return new Ext.grid.GridEditor(this.startTime);

}

return Ext.grid.ColumnModel.prototype.getCellEditor.call(this,colIndex,rowIndex);

};

猜你喜欢

转载自blog.csdn.net/u011056985/article/details/49923559
3.4
今日推荐