JS Code for highlighting specific text

Hi Forum,

Could someone help me check/adjust the below code to make it work?
I have added the last part with the Codes declaration and the script will not work. Before I added the Codes declaration there was no issue (P.S. I am super beginner and inherited this from a previous person):
{

configurecolumns: function(columns) {

for (var i= 0 ; i<columns.length; ++i) {

if (columns[i].text == 'PR' ) {

columns[i].align = "center" ;

columns[i].flex = . 05 ;

}

if (columns[i].text == 'TKT' ) {

columns[i].align = "center" ;

columns[i].flex = . 70 ;

columns[i].renderer = EradUtil.ticketNumberCellRenderer;

}

if (columns[i].text == 'Agent' ) {

columns[i].flex = . 90 ;

}

if (columns[i].text == 'Codes' ) {

columns[i].align = "center" ;

columns[i].flex = . 40 ;

}

if (columns[i].text == 'Pending' ) {

columns[i].align = "center" ;

columns[i].flex = . 60 ;

}

if (columns[i].text == 'Assigned Mins' ) {

columns[i].align = "center" ;

columns[i].flex = . 60 ;

}

if (columns[i].text == 'Esc' ) {

columns[i].align = "center" ;

columns[i].flex = . 10 ;

}

}

for (var i= 0 ; i<columns.length; ++i) {

if ( 'Pending' .indexOf(columns[i].text) > - 1 ) {

columns[i].renderer = function (value, meta, rec) {

if (value > '0:19' ) {

meta.style = "background-color:red;font-weight:bold;color:white;" ;

}

else if (value > '0:09' ) {

meta.style = "background-color:orange;font-weight:bold;color:white;" ;

}

else {

meta.style = "background-color:green;font-weight:bold;color:white;" ;

}

return value;

};

}

for (var i= 0 ; i<columns.length; ++i) {

if ( 'Codes' .indexOf(columns[i].text) > - 1 ) {

columns[i].renderer = function (value, meta, rec) {

if (value == 'AM' ) {

meta.style = "background-color:red;font-weight:bold;color:white;" ;

}

end if

}

}

}

}

At the very least, you need to format the code so we can read it.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around the code.


Unless this is a comment that didn’t translate correctly in the posted code, then that isn’t JS. There is no endif in JS.