ListGrid style change

584 Views Asked by At

I want to mark specific rows of my ListGrid with different background colors. My main issue is how to get List of ListGridRecord objects after data is retrieved from datasource. I use DataSource, and I have field defined in DataSource on which I will base decision how to color particular record.

I would iterate all ListGridRecord's after datasource returns data, and then use this attribute:

ListGridRecord.customStyle
1

There are 1 best solutions below

0
On

You can use getCellCSSText or getBaseStyle like this :

getCellCSSText: function (record, rowNum, colNum) {
                if ((this.getFieldName(colNum) == "OBJ_NAME") || (this.getFieldName(colNum) == "OBJ_DESC")  || (this.getFieldName(colNum) == "OBJ_KIND_NAME") || (this.getFieldName(colNum) == "FATHER_NAME") ){
                    if (record.OBJ_ACTIVE == false) {
                        return "color:red;text-decoration:line-through;font-style:italic;";
                        }
                }
            }

Here is an example : http://smartclient.com/#replaceStyle