|
|
Line 189: |
Line 189: |
| === Row scripts === | | === Row scripts === |
|
| |
|
| You can define multiple row designs for a view, and then you can define conditions when specific row design should be used. In the following example, we will create a second row with red background, this will be used when the field Name does not contain data. | | You can define multiple row designs for a view, and then you can define conditions when specific row design should be used. See '''[[Row script]]''' for more information. |
| | |
| {{Note|Please check this [http://blog.resco.net/2015/08/11/conditional-formatting/ BLOG POST] for an additional example of row script use. {{Badge|Blog}} }}
| |
| | |
| ==== Creating a new style with red background ====
| |
| | |
| # Click '''Edit Styles''' to display the [[Style editor#Views|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.
| |
| | |
| ==== Creating 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''.
| |
| | |
| ==== Creating 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'''.
| |
| | |
| ==== Rows and Rules in the upper menu ====
| |
| [[File:View_upper_menu_rows_rules.png|600px]]
| |
| | |
| ===== Rows section =====
| |
| * Copy Design – changes current row template design
| |
| * Add Row – adds a new row template
| |
| * Clone Row – adds a new row template, design is copied from the current template
| |
| * Delete Row – deletes the current row
| |
| * Up / Down – changes the order of rows. The order can be seen in a left menu under "Row". The first row template is the default one. It is important for example when using the custom responsive layout.
| |
| | |
| ===== Rules section =====
| |
| Each of these buttons opens the [[Rules_editor#Actions_that_trigger_rule_execution|Rules editor]].
| |
| * Row Script – opens the row script editor
| |
| * On Save / On Change – opens the rule editor, applicable when [[#Editable_field|Editable field]] is set.
| |
| * Button Click – opens the rule editor, applicable when using buttons in a view.
| |
| * Cell Click – opens the rule editor, defines actions after clicking on a cell
| |
| * iFrame – adds JavaScript to a view
| |
| | |
| {{Note|Do not use [[Rules_editor#Entity_type|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.|Warning}}
| |
| | |
| ==== Changing 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.
| |
| | |
| To learn more about this approach, please check this part of [https://youtu.be/iLZ43KxGEW0?t=17m19s WEBINAR] and [https://youtu.be/iLZ43KxGEW0?t=21m16s HERE] to see the setup and see it in action. {{Badge|Webinar}}
| |
|
| |
|
| === Best practice in renaming a view === | | === Best practice in renaming a view === |