1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    5
    Vote Rating
    0
    jjmiller1980 is on a distinguished road

      0  

    Question Format dataGrid data

    Format dataGrid data


    I'm trying to accomplish something that I kind of feel silly for not being able to figure out. I'm trying to add a CSS class to the cells of a dataGrid.

    I've tried setting up a renderer that is simply

    Code:
     
    function formatCells(val){
        return "<span class='myClass'>" + val + "</span>";
    }
    but it told me that it was missing a ";".

    Then I read somewhere that you should be able to say metadata.css = 'myClass', so I tried that. Now it says "metadata is not defined". It seems like this is way harder than it needs to be, I've never spent this much time trying to figure out how to change a font and center align something.

    Anybody know what the easiest way to accomplish this is? Also, is there a way to apply a separate CSS class to the header row?

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Location
    Cambridge, UK
    Posts
    164
    Vote Rating
    0
    Uberdude is on a distinguished road

      0  

    Default


    Using metadata.css is a good way to do this, but you forgot to define metadata as being the 2nd parameter passed to the renderer function.

    Check out the docs for the renderer function at http://dev.sencha.com/deploy/ext-3.4...olumn-renderer it contains other params such as the rowIndex so this should let you do special things for the header.

Thread Participants: 1

Tags for this Thread