Results 1 to 4 of 4

Thread: Changing the color of a cell in a grid

  1. #1

    Default Changing the color of a cell in a grid

    Hello all,
    i have written an extjs app where i am loading data into a GridPanel.
    the data loaded contains columnX, columnY and columnZ

    I want to do so that if the value of columnX is different from teh value of columnY, the
    background of columnX and columnY should be red

    anyone coudl help me in achieving that?

    thanks in advancea nd regards
    marco

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

    Default

    Use a combination of GridView.getRowClass, and ColumnModel's column IDs.

  3. #3
    Sencha User dlbjr's Avatar
    Join Date
    Oct 2007
    Location
    Cache, OK USA
    Posts
    281

    Default Try something like this:

    Code:
    {
         header: 'Column X',
         dataIndex: 'columnX',
         hideable: false,
         sortable: true,
         width: 75,
         align: 'right',
         renderer: function(data, cell, record, rowIndex, columnIndex, store) {
              if (data.toString().trim() != record.get('columnY').toString().trim()) {
                   cell.attr = 'style="background-color: #ff0000;"';
              }
              return data;
         }
    }
    

    dlbjr - David L. Bryant Jr.

    Owner of
    dlbjr Technology Consulting
    Web2 System Developer & Consultant
    Focused on C.I. - Six Sigma - Shingo - Lean Technologies
    [email protected]

    Owner of:
    Attractive Graphics - "custom screen printing"
    [email protected]

  4. #4

    Default

    thank you dlbjr... that did it!!!!

    regards
    marco

Posting Permissions

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