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

Row Color

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

  • Row Color

    I've used some custom formatting to change the color of a whole row. This works great, except the summary rows on my grid are the same color as the row prior. I can't work out how to prevent the summary row from picking up the same color. Here's the code I used:

    Code:
    var dCol = rec.get('D_COLOR')
    if (dCol.startsWith('#')) {
        setTimeout(function() {
            var gridView  = grid.getView(),
                  rowNode = gridView.getNodeByRecord(rec);
    
            if (!Valence.isEmpty(rowNode)) {
                var row = Ext.get(rowNode);
                if (!Valence.isEmpty(row)) {
                    if (summary.isRow === false) {
                        row.setStyle('background-color', rec.get('D_COLOR'));
                    } else {
                        row.setStyle('background-color', '#efefef');
                   }
                }
            }
        }, 150);
    }
    return v;
    Any help would be appreciated
    Last edited by sean.lanktree; 10-17-2023, 01:39 PM. Reason: Formatting the code

  • #2
    Here you go

    Code:
    if (Valence.isEmpty(summary) || !summary.isRow) {
        var dCol = rec.get('D_COLOR');
        if (dCol.startsWith('#')) {
            setTimeout(function () {
                var gridView = grid.getView(),
                    rowNode = gridView.getNodeByRecord(rec);
    
                if (!Valence.isEmpty(rowNode)) {
                    var row = Ext.get(rowNode);
                    if (!Valence.isEmpty(row)) {
                        var rowTr = row.down('.x-grid-row');
                        if (!Valence.isEmpty(rowTr)) {
                            rowTr.setStyle('background-color', dCol);
                        }
                    }
                }
            }, 150);
        }
    }
    return v;

    Comment

    Working...
    X