TemplateGrid styling of an attribute based on value

Hi, In a templategrid, is there anyway to style a particular field depending on it's value? We can add easily a class or style to the field, the problem is that when you look at the html code generated, the value is not there. The only thing you see is: <input class="templatesystemTemplateGrid_textBox activationStatusInput" name="activationStatus" readonly=""> How can we get the value? Regards, Philippe
2 answers

I developed a widget for that purpose. It uses a second attribute as class. So you can change the background color, font, images etc with a class. Available here



You can add classes to elements in the Modeler. Doing this conditionally in a TemplateGrid is a bit tricky, but I think the following might work:

  • Create a form with a dataview of the entity that you want to display
  • In this form, make table rows that are conditionally visible based on attribute values of the object
  • place the fields you want in the table rows and associate classes or styles with them to achieve the look and feel that you want
  • Now on the original form - the one with the TemplateGrid, use the FormLoader widget from the appstore inside of the templategrid and have it load the form you just created

The reason FormLoader is needed is that TemplateGrid won't allow conditional row visibility

Hope that helps,