PDA

View Full Version : How to set disabled field column on grid depending on record value (EXTJS) ?



andomichael
13 Dec 2012, 12:40 AM
Hy, i new to use Extjs..
i have a gridpanel like this:




var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});

var myGrid = Ext.create('Ext.grid.Panel', {
store: myStore,
plugins: [cellEditing],
columns: [
{dataIndex: 'colid', hidden: true},
{text: "Name", dataIndex: 'colname', sortable: true},
{text: "Info", dataIndex: 'colinfo', sortable: true},
{text: "Value", dataIndex: 'colvalue',
editor: {
xtype: 'textfield'
}
}
]
});


Now i want to set editor to null (like column colinfo,colname and colid) column colvalue when colinfo value is "Can not edit this value!!"..
How i to configure that's condition??

droessner
13 Dec 2012, 5:59 AM
You can add a beforeedit listener to your plugin and have it return false when you don't want the cell to be editable.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.plugin.CellEditing-event-beforeedit