PDA

View Full Version : Dynamically apply colors to grid Rows...



amol
18 Dec 2009, 3:36 AM
Hi All,

My question is that I have a database table containing names of customers .In the table I am having a field color code.I have to fetch colors from the color code field in he database and apply them to grid rows .In the grid I am displaying the names of all the customers fetched from the same database table.
Can anybody provide me with a sample code on how I can apply this colors(fetched from the color code field in the database table) to the grid rows.Suppose the colors(color code) in the database table change then this color change should also be applied to the grid

Can anybody help me with this???:(:(


Thanks in advance......
Amol J

realjax
18 Dec 2009, 4:05 AM
check the docs on 'getRowClass' of Ext.grid.GridView

(http://www.extjs.com/forum/../deploy/dev/docs/source/GridView.html#cls-Ext.grid.GridView)

amol
18 Dec 2009, 10:31 PM
Ya realjax (http://www.extjs.com/forum/member.php?u=85197) thanks for the help but I have already used getRowClass(record,rowIndex,rp,store) and using record.data.color_code I am able to retrieve the color_codes but the main problem is after retrieving how to apply it to grid rows??? :-?

amol
19 Dec 2009, 12:06 AM
I used rp.tstyle="background-color:"+record.data.color_code for that
=P~