-
16 May 2012 9:46 AM #1
Inconsistent behavior in column config?
Inconsistent behavior in column config?
I just noticed that if I define a column with defaults and assign it a renderer plus a style the style is applied to just the header, but the cell renderer is applied to each cell.
Is this expected behavior?
Here is my code:
And a demo on JSFiddle, http://jsfiddle.net/JamesFM/S37ud/ Note that while JSFiddle is using 4.0.7, I see the behavior on 4.1.0 as well.Code:Ext.create('Ext.data.Store', { storeId : 'simpsonsStore', fields : ['name', 'email'], data : { 'items' : [ { 'name' : 'Lisa', "email" : "lisa@simpsons.com"}, { 'name' : 'Bart', "email" : "bart@simpsons.com"}, { 'name' : 'Homer', "email" : "home@simpsons.com"}, { 'name' : 'Marge', "email" : "marge@simpsons.com"} ] }, proxy : { type : 'memory', reader : { type : 'json', root : 'items' } } }); Ext.create('Ext.grid.Panel', { title : 'Simpsons', store : Ext.data.StoreManager.lookup('simpsonsStore'), columns : { defaults : { flex : 1, style : { // why is this only effecting the header? 'font-weight' : 'bold', 'color' : 'red' }, renderer : function (val) { return '<span style="color:blue;">' + val + '</span>'; } }, items : [ { header : 'Name', dataIndex : 'name'}, { header : 'Email', dataIndex : 'email'} ] }, height : 200, width : 400, renderTo : Ext.getBody() });
EDIT: I have since corrected the JSFiddle to use 4.1.0.
-
24 May 2012 6:56 AM #2
Did I put this thread in the wrong place?
-
25 May 2012 12:30 PM #3Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
Did you try specifying the renderer on the actual column items?
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.
-
25 May 2012 12:34 PM #4
Yup. That behaves exactly the same as far as I can tell.
You would expect it to right?
-
25 May 2012 12:38 PM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
I have never had this issue. What is rendered on screen always is what the renderer returns.
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.
-
25 May 2012 12:44 PM #6
It's not that the renderer doesn't work, it's that the behavior for the style object and renderer function is inconsistent.
The style only gets applied to the header, and the renderer only effects the rows. Take a look at http://jsfiddle.net/JamesFM/S37ud/ for an illustration of it in action.
This might be a bug, I just wanted to make sure I wasn't misunderstanding how this was suppose to behave.
-
25 May 2012 12:59 PM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
Oh I see, to be honest the style config should be deprecated as styling an app should all be done with CSS files.
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.


Reply With Quote