View Full Version : How to disable/enable cell editing based on the value selected in a combobox?

26 Apr 2012, 2:25 AM

I want to disable/enable cells according to the value in the which is selected in the combobox in the same row.
I am using a listener to get the value of the combobox..but not able to figure out how to use that value to disable/enable the other cells in the same row.

Please give an idea.

This is my grid panel

this.columns = [

header : 'Abc',
sortable : true,
dataIndex : 'abcDesc',
displayField : 'description',
grid : me
{header: " Comments", dataIndex: 'Comments'},
{header: "Days", dataIndex: 'Days'}
abcDropdownColumn : function(config) {
return {
header : config.header,
//width : config.width,
dataIndex : config.dataIndex,
editor : {
xtype : 'combo',
id: 'rightsCombo',
editable : true,
allowBlank : false,
queryMode : 'remote',
typeAhead : true,
//hideTrigger : true,
store : 'Store',
displayField : 'abcDesc',
valueField : 'abcDesc',
triggerAction : 'all',
forceSelection : true,

listConfig : {
loadingText : 'Searching...',
emptyText : 'No matching abc...'
grid: config.grid,
displayFieldUpdateTarget: config.displayField,
listeners: {
select: function(combo, records, opts) {
if (records.length > 0) {
var record = this.grid.getStore().getAt(this.grid.getSelectionModel().position.row);

if(records[0].data.commonProperty == " Exhibition"){

//need to put the condition here so as to make the "comment" cell and "days" cell editable




26 Apr 2012, 5:56 AM
I would try a different approach:
Implement the enable /disable rule in the beforeEdit method of the cell editor which you provide to your grid (Ext.grid.plugin.CellEditing) The comboBox returns the value in the record of the current row and when you want to start editing another cell check if the editing is allowed

beforeEdit : function(context) {
if (context.field == "
Days" && context.record.get("
abcDesc") == "xxx" ) {
return false;

Check the docs to see what else is available in the context parameter