1. #1
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Vote Rating
    5
    whirling dervish is on a distinguished road

      0  

    Default 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:

    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()
    });‚Äč
    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.

    EDIT: I have since corrected the JSFiddle to use 4.1.0.

  2. #2
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Vote Rating
    5
    whirling dervish is on a distinguished road

      0  

    Default


    Did I put this thread in the wrong place?

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,824
    Vote Rating
    836
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Did you try specifying the renderer on the actual column items?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Vote Rating
    5
    whirling dervish is on a distinguished road

      0  

    Default


    Yup. That behaves exactly the same as far as I can tell.

    You would expect it to right?

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,824
    Vote Rating
    836
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    88
    Vote Rating
    5
    whirling dervish is on a distinguished road

      0  

    Default


    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.

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,824
    Vote Rating
    836
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread