Javascript Formatter for color

Confluence User - 13 May, 2022

Hi, I wanted to indicate color to the text in my datalist. I've tried using Javascript Formatter but it doesn't work as my condition are:-

I wonder if my scripting is wrong or method used is not applicable. 

Thanks.

datalists

1


17 May, 2022
confluenceUser
1
confluenceUser

Hi, instead of Javascript Formatter, you can use Bean Shell Formatter to achieve it.

I have written a script based on the example provided:

String result = "<div ";
String status = value;

if(status.equalsIgnoreCase("Work In Progress")){
    result += "style=\"color: red\">Work In Progress";
}else if(status.equalsIgnoreCase("Completed")){
    result += "style=\"color: green\">Completed";
}else if(status.equalsIgnoreCase("Close")){
    result += "style=\"color: orange\">Close";
}

result += "</div>";

return result;
RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print