Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Gustavo Roa

Pages: [1]
1
I already have in my Column Model something like this working
        {
            title: "Number of days",
            width: "15%",
            dataType: "string",
            editable:false,
            dataIndx: "DataColumn",
            render: function (ui) {
                // Conditional Styling depending on DataColumn value
                if (parseInt(ui.rowData.DataColumn.replace(/[^0-9]/g, '')) >= 5 && parseInt(ui.rowData.DataColumn.replace(/[^0-9]/g, '')) < 10) {
                    return { style: "background:yellow; color: navy;" };
                }
                if (parseInt(ui.rowData.DataColumn.replace(/[^0-9]/g, '')) >= 10) {
                    return { style: "background:red; color: white;" };
                }
            } // Conditional styling code ends
        }

Now, I need to move the styles passed to the CSS file, so I created the following classes:

.dashboard-red {
    background:red;
    color: white;
}

.dashboard-yellow {
    background:yellow;
    color: navy;
}

Now I need to assign it to the column, so I did this, but it is not working:

         {
             title: "Number of days",
             width: "15%",
             dataType: "string",
             editable: false,
             dataIndx: "DataColumn",
             render: function (ui) {
                 // Conditional Styling depending on DataColumn
                 if (parseInt(ui.rowData.DataColumn.replace(/[^0-9]/g, '')) >= 10 && parseInt(ui.rowData.DataColumn.replace(/[^0-9]/g, '')) < 20) {
                     return { class: "dashboard-yellow" };
                 }
                 if (parseInt(ui.rowData.DataColumn.replace(/[^0-9]/g, '')) >= 20) {
                     return { class: "dashboard-red" };
                 }

             } // Conditional styling code ends

It is not working, what I am doing wrong?

Thanks and best regards

Pages: [1]