So far I use the following function to change the bgColor of a single field in the table, and I call that function in the onRender of that field.
However when I start to call that function on some other fields/columns, I get exception messages like this:
TypeError: Cannot read property "pe_level_nr" from (D:\workspaces\projecteim\project\forms\frm_project_wbs_costs_tbl.js#918)
(That started when I set the onRender for a date field, but I could not see any reason why that date field did not like the onRender.)
My question: is there another way to change the bgColor of a complete table line based on a specific condition, other than calling the onRender for each table field/column?
- Code: Select all
function onRender(event) {
var
/** @type {JSRecord<db:/bob/project_elements>} **/
rRec = event.getRecord();
if (rRec.pe_level_nr >= 2 && rRec.pe_is_leaf != 1) {
event.getRenderable().bgcolor = bgColorLevel2;
}
else if (rRec.pe_level_nr === 1) {
event.getRenderable().bgcolor = bgColorLevel1;
}
}