1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default


    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

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    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.

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    54
    Vote Rating
    0
    alfa19 is on a distinguished road

      0  

    Default


    mmm...now is very clear...thanks a lot, i try