field/table cell background color

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
TK
Posts: 5
Joined: Fri Jun 08, 2018

13 Feb 2020

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 3241 times

Your help is greatly appreciated...

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

14 Feb 2020

Hello TK,

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

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests