Ticket #29371
Question
In m-Painter, I set a condition to put the line in red. The line is changed to red but only up to the point where "No Inventory" is displayed. When "No inventory" is displayed, the cell has it's own condition to be a yellow color. The problem is all the cells to the right of that cell get the wrong color, that is all become yellow instead of red. Why does this happen?
Answer
Explained to customer when you add a color condition to the table, behind the scenes Freemarker if/else logic is used to determine for your rows/cells what the style attribute evaluates to. When you add a second condition, like trying to conditionally color one specific cell within the row that already has a condition, the Freemarker logic once it hits this cell with a new condition, the following cells will now turn yellow because you have overwritten the style substitution in Freemarker to be yellow instead of red. You can have multiple conditions on a single row, however this specific setup you are looking to have, which is to retain the red color after the cell condition of yellow, would have to be done via custom Freemarker if/else logic in the HTML source. Now instead of using custom Freemarker, something I think is more inherently m-Power for the sake of solving this question, is to color code the row to red via m-Painter as you normally would. And now for the cell condition, instead of going through m-Painter to create this, create a conditional calculation that based on the value of the cell, outputs a specific color or hex code that matches the color you would want the background color to be. You can use this value of the conditional calculation as an applied style (to the [style="background-color: ${row.CALCULA001?html}"]in your HTML source for the particular cell (<td>) you want the condition on. At runtime, the calculation just evaluates on each cell to the appropriate color for 'background-color' attribute.
Asked on August 14, 2019