Hi,
I am trying to set different background colors according to the text in the cell within a column. (ex: green for "Yes" and red for "No") The following sets the color for the entire column:
IGTextColumn statusColumn = new IGTextColumn("status");statusColumn.setBackgroundColor(android.graphics.Color.GREEN);
Can you please provide with a simple example how to achieve this?
Thanks
Hi Elton,
What you are looking for is conditional formatting. The best way to do this with the IGGridView is by creating a custom IGColumnDefinition class and overriding the getCell method. Inside this method you can get the cell and based on the cell value you can set the cell's background color. I have attached a sample that demonstrates this. The code you want to look at is in YesNoColumn.java. You should also look at CustomTextCell.java as well. My grid is defined in MainActivity.java.
Let me know if you have any questions.