• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Can color rules for column be applied to entire row?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can color rules for column be applied to entire row?

    When creating a grid widget, is there is a way to control the color of the whole row with rules other than putting the same rules on each individual column?

  • #2
    This can be achieved by adding custom formatting to one of the columns in the grid.

    For example, I want to change the color of the row when the customer has a state of "IL"
    Code:
    // if column "CSTATE" equals "IL" change the background color of the row
    //
    if (rec.get('CSTATE') === 'IL') {
        setTimeout(function() {
            var gridView = grid.getView(),
                rowNode  = gridView.getNodeByRecord(rec);
    
            if (!Valence.isEmpty(rowNode)) {
                var row = Ext.get(rowNode);
                if (!Valence.isEmpty(row)) {
                    row.setStyle('background-color', '#81D4FA');
                }
            }
        }, 150);
    }
    return v;
    NAB Grid Row Color Change.png

    Comment

    Working...
    X