Highlight text in different color - Dynamic data grid

I would like to highlight the list of elements populated in data grid dynamically based on some conditions which should not be visible in UI. For example:  displaying data grid with person name and position. I would like highlight the higher hierarchy person alone in green (Manager & above) without displaying their designations in UI. Technically there won't be any HTML reference element to filter & highlight those names. Please share your ideas to solve this case?
3 answers

I see that you are using the 5.21 modeler. You can try the datagrid extension widget. It supports styling rows in a datagrid based on a value.




I see two options. Since the first one with the HTML snippet seems feasible and a bit better maintainable, I would go for the first option. The custom widget would have the benefit that you do not have to create an extra attribute, but you would possibly need extra database calls from the widget, to check which row to highlight.

Extra technical attribute + HTML snippet

  1. Add an extra technical attribute in the entity, something like _highlighted which is a boolean;
  2. Populate the value of this attribute by Mendix microflow logic;
  3. Populate the datagrid with that entity, but make sure the technical attribute is not shown (zero width);
  4. Add a HTML snippet widget below the datagrid;
  5. In the HTML snippet add code to target the grid, iterate through the rows and based on the technical attribute column value, highlight the specific cell/row/column via manipulating the CSS with JavaScript.


Custom widget



A new widget was just published that does this.  Its called Grid Cell Styler and you can find it here:  https://appstore.home.mendix.com/link/app/106254/  It would require you to upgrade your app, but might be worth looking into.