Skip to Content
0
Sep 06 at 05:45 PM

Row Color change for dynamic table binding in controller

264 Views

Hello Experts,

I want to change the background color of a row, declared dynamically in a controller(not in a View), based on the flag.

The color should be added in JS.

for more details please refer to the following code.

 

Controller.js-------

var Data= this.RemoveDuplicateList(JSON.parse(JSON.stringify(this.Data)));

jModelForMainTbl.setData({ rows: Data, columns: columnData });

for(var i = 0; i <= Data.length; i++){ if (Data[i].Flag=== "X") { Data[i].addStyleClass("red"); } }

Style.css

.red { background: #FF3300 !important; }

The table data from the backend is fetched in the "Data" Variable based on which further condition is written to loop on it on the basis of the flag. The required result should give a background color to the row that meets the condition.

Please guide for a proper solution, if need be changes can be made in the above code.

Thanks in anticipication.