简体   繁体   中英

Lightswitch HTML Client 2013 - Change Cell Color Depending Upon Cell Value in table

trying to get the background of a boolean value to change based upon true or false... trying this code and its not working with a bit field however does work on a string, any ideas guys?

if (contentItem.value && contentItem.value.substring(0, 1) == 1) {
    $(element).closest("td").css("background-color", "green");
}

and the below code changes the whole column based on the top row value only:

if (contentItem.value = 1) {
    $(element).closest("td").css("color", "green");
}
else 
{
    $(element).closest("td").css("color", "red");
}

got it:

if (contentItem.value && contentItem.value == 1) {
    $(element).closest("td").css("color", "green");
}
else 
{
    $(element).closest("td").css("color", "red");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM