-
14 Mar 2012 5:39 AM #1
Render entire row of a grid
Render entire row of a grid
Hello,
i have a grid like this
| ID | Name | Gender |
i wanna color entire row of blue if Gender is M, of pink if gender is F. I have found how to color the single coloumn, but not the entire row.
Anyone can help me? Thanks a lot.
-
14 Mar 2012 8:46 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
After the grid rows have been rendered, I would iterate through the store and check the value. I would then add the class to the <tr> for that row based on value of the record.
If you have a column for it then in your renderer you can add the rowIndex argument to an array and then iterate through that array to then add a class to the <tr>Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Mar 2012 9:03 AM #3
uhm...i didn't understand very well...can u post a brief code?
let us suppose that i don't have a coloumn in the grid instead, but the value is still contained in the store..is it still possible?
thanks
-
14 Mar 2012 9:09 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
Just typing off the top of my head but should describe what I am saying..
Code:var rows = grid.getView().getEl().query('tr'), // get row <tr>s index, el; store.each(function(rec) { if (rec.get('sex') === 'M') { index = store.indexOf(rec); el = Ext.get(rows[index]); el.addCls('row-class'); } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Mar 2012 9:19 AM #5
mmm...now is very clear...thanks a lot, i try



Reply With Quote