Once your logic has determined that the colour of the background needs to change you get the column index and set the tdCls class to a relevant CSS class. Make sure you call refresh on the grids view once you've finsihed changing configuration.
I've created a fiddle to demonstrate the concept.
<style>
.invalid-column, .x-grid-row-alt > .invalid-column {
background-color: red;
color: white;
}
</style>
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.create('Ext.data.Store', {
storeId: 'userStore',
fields: ['user', 'percent'],
data: {
'items': [{
'user': 'John',
"percent": 50
}, {
'user': 'John',
"percent": 20
}, {
'user': 'John',
"percent": 20
}, {
'user': 'John',
"percent": 10
}]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create("Ext.grid.Panel", {
renderTo: Ext.getBody(),
title: "Test",
store: Ext.data.StoreManager.lookup('userStore'),
columns: [{
header: 'User',
dataIndex: 'user'
}, {
header: "Percent",
dataIndex: "percent",
editor: {
xtype: "numberfield",
allowBlank: false
}
}],
selType: "cellmodel",
plugins: {
ptype: "cellediting",
clicksToEdit: 1
},
listeners: {
"edit": function(editor, context, eOpts) {
var store = this.getStore();
var total = 0;
store.each(function(record) {
total += record.get('percent');
});
if (total < 0 || total > 100) {
this.columns[1].tdCls ='invalid-column';
this.getView().refresh();
}
}
}
});
}
});
EDIT: Code was wrongly tested against ExtJs 5, Updated for ExtJs 4.2