# Help with Dashboard HTML

**URL:** <https://discourse.nodered.org/t/help-with-dashboard-html/79171>\
**Category:** Dashboard\
**Created:** [13 June 2023 13:11 UTC](https://discourse.nodered.org/t/help-with-dashboard-html/79171 "2023-06-13T13:11:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [13 June 2023 13:11 UTC](https://discourse.nodered.org/t/help-with-dashboard-html/79171/1 "2023-06-13T13:11:35Z")

</div>

HTML assistance. I'm hoping that I have a good start on it.

I'm trying to populate a table with rows of values from a database query. That is all great. I added code for the CSS Class .warning{ } and .alarm{ } to provide a means of COLOR Rows, alerting to values 5% to 8% being warning and over 8% alarm. I took the javascript from an example, but I believe my repeater and syntax to display values is goofed and I am not sure how to express the same item such that the javascript can actually calculate the values and work.

Dashboard template HTML below

````auto
    th {
        text-decoration: underline;
        font-size: 25px;
        font-weight: bold;
    }

    .percent {
        text-align: center;
        font-size: 20px;
        font-weight: bold;
    }

    .numeric {
        text-align: right;
        padding-right: 15px;
        font-size: 20px;
        font-weight: bold;
    }

    .alpha {
        text-align: left;
        padding-left: 20px;
        font-size: 18px;
        font-weight: bold;
    }

    .warning {
        background-color: yellow;
    }

    .alarm {
        background-color: red;
    }
</style>
<body>
<table cellpadding="1" border="1" id="table1" class="table-hover" style="width: 1200;">
    <thead>
        <tr>
            <th>ChScanner</th>
            <th>Total</th>
            <th>Good</th>
            <th>% GD</th>
            <th>Mismatch</th>
            <th>% MM</th>
            <th>NoRead</th>
            <th>% NR</th>

        </tr>
    </thead>
    <tbody>
        <tr class="product-row"; ng-repeat="row in msg.payload">
            <td class=alpha bgcolor=white>{{row.ChScanner}}</td>
            <td class=numeric bgcolor=white>{{row.Total}}</td>
            <td class=numeric bgcolor=white>{{row.Good}}</td>
            <td class=percent bgcolor=white>{{row.PGD}}</td>
            <td class=numeric bgcolor=white>{{row.Mismatch}}</td>
            <td class=percent bgcolor=white>{{row.PMM}}</td>
            <td class=numeric bgcolor=white>{{row.NoRead}}</td>
            <td class=percent bgcolor=white>{{row.PNR}}</td>

        </tr>
    </tbody>
</table>
<script>
    const rows = document.querySelectorAll(".product-row");
 for(let i = 0; i < rows.length; i++){
    const result = rows[i].querySelector(".PNR").textContent;
    if(result >= 5 && result < 8){ 
          rows[i].classList.add("warning");
        } 
    else if(result >= 8 ){ 
          rows[i].classList.add("alarm");
        } 
}
</script>
</body>```
````

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 July 2023 13:12 UTC](https://discourse.nodered.org/t/help-with-dashboard-html/79171/2 "2023-07-13T13:12:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
