Context Setter
The context setter is functionality which can be enabled on read views. Read views are multi record and single record views. The main idea is that you can retrieve extra information by clicking on the context setter icon. The most common use case is to give a master detail overview to an end user. Take for instance that you have a list of sales orders. Clicking on a certain sales order, gives you all the items from the selected sales order.
When enabling the context setter on a read view, all other components on the page will be refreshed with the current row context. Hidden fields are also send as context. If you want that the context setter interacts with other components, it is important that the name of fields (not the label) matches with the name of the input fields of the other components.
On the image below, the Product Id field is send to all components. If another component wants to display more information about the selected product, this component needs to accept the input field: Product Id.
Context Setter Scope
The default scope of the context setter functionality is that of the page. This means that the context is applied as long as the page is not refreshed. When the page is refreshed, the scope is cleared. If you want to save the state you need to add a context manager component to the page.
Limit Refresh Other Components
The default behaviour of the context setter is that all other components will be refreshed. The component where the user has clicked on, will never refresh itself. If you want to only refresh a specific set of components, you need to configure this.
Component and View Type Behaviour
Depending on the component type, the context setter will have a different implementation.
Multi record, single record views and charts will just refresh themselves. This means that the method configured on this view will be re-executed. For an update view, the configured single record view will be re-executed.
For a create view, all matching fields will be filled out if the form is pristine. A pristine form is a form which hasn't been made dirty by filling out values in this form. If the form is dirty, the user will get the option to keep the existing values or to take the new incoming values. This can be seen on the image below.
Views opened in dialogs will also follow the logic like above. If you don't want this behaviour you have to configure the Modal Dialog
option in the layout tab of the views.
Configuration
The context setter can be configured in the Advanced tab of a multi record or single record view.
- If no context listeners are configured, all components on the page will be refreshed.
- Specify context listeners if you want to limit the refresh of components.
In the next example, only the Get Single Product view will be refreshed.
Icons
The context setter has two states: active and inactive. For both states you can configure an icon. By default you get a toggle icon. You can configure the icons in the Layout tab of the multi record or single record view.