Page 1 of 1

field/table cell background color

Posted: 13 Feb 2020
by TK
Hi there,
i have an "approval status drop down field" in a table cell. i would like to have 3 colors dynamically changed depending on the status
Approved - green
Pending - yellow
Reject - red

I tried the following code... it works but it chnges only title and element itself, i would like to change background for the cell where the dropbox item is placed instead
function EntryHandler() {
    if (!fd.field('ApprovalStatus').value()) {
        fd.field('ApprovalStatus').title()._el().addClass('highlight');
        fd.field('ApprovalStatus').control()._el().addClass('highlight');
    } else {
        fd.field('ApprovalStatus').title()._el().removeClass('highlight');
        fd.field('ApprovalStatus').control()._el().removeClass('highlight');
    }
}
fd.field('ApprovalStatus').change(function()
{
EntryHandler();
});
EntryHandler();
2020-02-12_194312.png
2020-02-12_194312.png (1.3 KiB) Viewed 3254 times

Your help is greatly appreciated...

Re: field/table cell background color

Posted: 14 Feb 2020
by mnikitina
Hello TK,

You can assign a CSS class to the table cell, e.g. change-color.
CSS.PNG
CSS.PNG (9.38 KiB) Viewed 3244 times
And change the background color of the cell dynamically with the following code.

$('table.change-color').css('background-color', 'red');