Good Morning Portals Community,
I am trying to build a client portal with a entity (table) 'view' for status reports. In this view, I have a RAG status of "Red", "Amber" or "Green", based on a Choice attribute in the entity column.
I have been trying to adapt the Microsoft sample custom javascript to colour code the "Red" "Amber" or "Green" field in the webpage view. I can get it to colour everything one colour based on the first sample Javascript here - https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/entity-lists
When I try to adapt the code with a conditional statement based on the values in the tsam_ragstatus field, I can't get it to apply. Can anyone with a working knowledge of javascript in Portals assist please? Here is the code I am currently using. I suspect is has something to do with an incorrect identification of the tsam_ragstatus attribute?
Thanks in advance for any assistance
$(document).ready(function (){
$(".entitylist.entity-grid").on("loaded", function () {
$(this).children(".view-grid").find("td[data-attribute='tsam_ragstatus']").each(function (){
// do something with each row
if('tsam_ragstatus'==('Red')){$(this).css("background-color", "red")};
if('tsam_ragstatus'==('Amber')){$(this).css("background-color", "amber")};
if('tsam_ragstatus'==('Green')){$(this).css("background-color", "green")};
});
});
});