You can define multiple row designs for a view, and then you can define conditions when a specific row design should be used. In the following example, we will create a second row with a red background, this will be used when the field Name does not contain data.
|Note||Please check this BLOG POST for an additional example of row script use.|
Create a new style with red background
- Click Edit Styles to display the Style editor.
- Select primary from the style list, and then click Add. This creates a clone of the primary style.
- Change the BackColor (background), ForeColor (text color), and rename the style (for example Red Primary).
- Click Save & Close to close the styles editor and return to the view designer.
Create a second row
You have multiple options for creating rows:
- Click Clone Row to create a copy of the row selected in the Properties pane. Then rename the row, for example to RedRow.
- Click Add Row to create an empty row, where you can add fields and design it from scratch.
- You can also click Copy Design to copy the design of any view from any entity.
In the new row, select a cell and change the style from Primary to Red Primary.
Create a row script
To define when and how the different the row designs are used, you need to set up a row script. Row script is a combination of steps and conditions (what should happen and when).
- Click Row Script to open the script editor.
- Add the following conditions and steps.
- If entity.name does not contain data
- Then Step TemplateIndex Assign RedRow
- Else Step TemplateIndex Assign Default
- Click Save & Close.
|Warning||Do not use LoadFetch, LoadReference, and NewInstance in row scripts, even if Woodford allows you to configure them. These asynchronous operations do not work in this context and can cause problems.|
Change style on view dynamically
Since version 10.1, there is also a different option in changing the field style on view dynamically, based on its value or other conditions instead of creating a different row design. It is also possible to change the field’s style by using Row Script directly.