1

I have a propertyGrid in ExtJS. I want to color a cell's text when i fill it with content. The init method:

initGrid : function(propertyValues){
    this.model = Ext.decode(propertyValues);
    this.flexColumnGrid.setSource({});
    for(var i in this.model){
      //...
        var value = (this.model[i].value ? this.model[i].value : this.model[i].defVal);
        this.flexColumnGrid.setProperty(this.model[i].key, value, true);
    }

defVal is a default value to a property. I use that, when value is empty and there is defVal to property. I have a value validate method, but i only use that, when a property is change. It's the afteredit event.

edit : function(ed,e) {
   //validate values
}

I can color the cell's text at this method with

Ext.get(e.row.getElementsByTagName('td')[e.colIdx]).addCls('x-grid-wrong-value'); 

where:

.x-grid-wrong-value{color:red} //the css

but i want to validate the values when the grid is filled by content. How can i do this?

revell
  • 45
  • 2

1 Answers1

1

In general you should use getRowClass this is an example how to do this:

How to change background in row or cell

And this is an example: Fiddle for changing background

Community
  • 1
  • 1
Paweł Głowacz
  • 2,926
  • 3
  • 18
  • 25