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);

};

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章