jQuery UI Widgets Forums DataTable Color whole row based off a cell value?

This topic contains 2 replies, has 2 voices, and was last updated by  MatthewV 8 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Color whole row based off a cell value? #88479

    MatthewV
    Participant

    Is it possible to change the color of an entire row based off the value of one of the cells in that row? I saw in your demo section you can do this on a cell by cell case based off that cells value but I need to color the whole row based of the value in cell “Severity” so that is severity was say critical, that whole row would be red but if it was warning then it would be gray.

    $(document).ready(function ()
    {
        $("#AlarmData").jqxDataTable({
            columns: [
                { dataField: "Description", Text: "Description" },
                { dataField: "DateRaised", text: "Date Raised", cellsformat: "d" },
                { dataField: "FullPath", text: "Path" }
            ],
            columnsResize: true,
            sortable: true,
            source: new $.jqx.dataAdapter({
                dateFileds: [
                    { name: "FullPath", type: "string" },
                    { name: "DateRaised", type: "date" },
                    { name: "Description", type: "string" },
                    { name: "Severity", type: "string" }
                ],
                dataType: "json",
                id: "ID",
                url: "LocationAlarms?locationID=" + $("#ID").val()
            }),
            width: 600
        });
    });
    Color whole row based off a cell value? #88496

    Hristo
    Participant

    Hello MatthewV,

    Also, I would like to suggest to look at this example:
    https://www.jseditor.io/?key=datatable-set-row-color

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Color whole row based off a cell value? #88515

    MatthewV
    Participant

    Thanks, I was able to get it working using your example.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.