Results 1 to 4 of 4

Thread: Conditional row css for grid

  1. #1
    Ext GWT Premium Member
    Join Date
    Mar 2007
    Posts
    10

    Default Conditional row css for grid

    Does anyone have an example on how to set a different css to a row in a grid based on the data in that row? For example, if lets say I have a dataview of department budgets and I want to highlight all departments with a negative balance to red. Any thoughts?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    You probably want to override getRenderer in your ColumnModel to return a function for the column you are interested in that returns the HTML formatted as you require.

    Docs: http://www.yui-ext.com/deploy/yui-ext/docs/

    Specified in YAHOO.ext.grid.AbstractColumnModel

    Or, if you are using a DefaultColumnModel, you can specify a renderer for a particular column in the column config object.

  3. #3
    Ext GWT Premium Member
    Join Date
    Mar 2007
    Posts
    10

    Default

    I apologize if my question was unclear or I'm not understanding your response. What I'm looking for is a way to override the renderer for the entire row. I was looking at the renderRow method in the GridView, but I'm not sure how to override this, if this is even what I want to override. To try and be more clear....I want to be able to evaluate the data for the entire row and based on certain conditions, add an additional class for all the columns in that row so the row has a different color background.

    If this what you understood from my previous post, and your previous reply still stands, again I apologize. Can you direct me to an example on how this would work for what I want to do?

  4. #4
    Ext GWT Premium Member
    Join Date
    Mar 2007
    Posts
    10

    Default

    I think I found my answer in another post. Just needed to put the correct keywords in to find it. Looks like I do need to override the renderRow.

    http://www.yui-ext.com/forum/viewtopic.php?t=854

Similar Threads

  1. Conditional Grid Scrollbar
    By ilazarte in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 6 Feb 2007, 2:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •