Page 1 of 1

DataGrid-How do I set a certain row a certain color

Posted: Tue Oct 13, 2009 5:40 pm
by jschaube
In a DataGrid, I would like to set a certain row a certain color when one of it's cells has the word "Critical" in it. How do I do this?
Jim...

Posted: Tue Oct 13, 2009 6:46 pm
by trevordevore
This lesson from the manual shows how to colorize text in a row based on a value in the table.

How Can I Colorize Individual Lines in a Table?

Posted: Tue Oct 13, 2009 8:09 pm
by jschaube
Thanks Trevor...It works perfectly when I start a main stack from scratch but when I'm using your scripts on a stack I've already built (IE-following Kevin's script on setting the icons of the "country" buttons to flags) I can not get your script to work. His process has me creating column behaviors. Would this make your scripts break because I already have column behaviors?

Posted: Tue Oct 13, 2009 8:14 pm
by trevordevore
If you create column behaviors then you have to customize the script of each column behavior so that it colored the line. The issue is that creating a custom column template uses it's own behavior. This means that the default column behavior is no longer used.

Try customizing each column script right now (assuming you don't have too many) and see it you can get it working. If you do and want to consolidate code then let me know and I can point out some possibilities.

Posted: Tue Oct 13, 2009 8:33 pm
by jschaube
After I sent the post I figured I could modify each column behavior as you mentioned. Since you verified that thought, I feel much better about taking the time to do so :-)...I have 12 columns so no problem

Thanks for the timely responses !!!

Posted: Tue Oct 13, 2009 8:37 pm
by trevordevore
Glad you got it working.

You can always consolidate scripts by assigning the behavior property of the custom column templates to the same button. This would effectively share the same script among all columns. Of course this would mean adding an if/then or switch statement in your behavior script based on the column that was being targeted.