context.decorateRow
Available on views, Code tab> After Generate JS field, displays the view lines with different background based on a specific value of an attribute from the child entity.
Syntax
Copy
context.decorateRow(function (rowData, htmlRowElement)
| Parameter | Description |
|---|---|
rowData
|
The current row data. |
|
|
The JQuery<tr> element. |
Examples
In this example:
- On a view we show values for attribute "a_text".
- If the value of the attribute "a_text" is "green", the record view line will have the background green.
- If the value of the attribute "a_text" is "red", the record view line will have the background red.
Request
Copy
context.decorateRow(function (rowData, htmlRowElement) {
if (rowData["a_text"] == "green") {
htmlRowElement.css({ background: "green" });
}
else if (rowData["a_text"] == "red") {
htmlRowElement.css({ background: "red" });
}
});