Use filters in fieldlets
The following fieldlet ops are available in the Rule Designer palette.
These fieldlets have hidden filters which can be used to further limit the data selection that will be shown to the user:
-
Filter field- This field is a combo with every fieldlets that are in the form. It is important to save the form before use this combo, because the fieldlets unsaved will not appear in the combo. In this field, we are selecting the fieldlets where we pick up the values of the filter. -
Filter data- In this field, we have to introduce the key of our filter. -
Filter type- We have to select if we want a filter with or-logic or with and-logic.
Examples¶
Say we want to filter topics by users. There are two fieldlets, the first one is a user combo with id 'users', and the second one is topic selector with id 'topics'. The fieldlets 'users' has to be in the form above topics fieldlet. In the topics fieldlets, we would select:
- Filter field - users.
- Filter data - owner.
- Filter type - OR.
So we introduce the following value to filter the data:
{'owner':$in['user-1, user-2..']}
Now, we want to filter a resource combo using a pill. The first step, is creating a pill with the id 'pills' and the following setting:
- Option settings - user;project
- DefaultValue - user
Then, we create a ci combo with id 'ci_combo'. For this fieldlet we have to select:
- Filter field - pills.
- Filter data - collection.
- Filter type - OR.
Now, we are going to create a more complex filter. We create two fieldlets, one ci combo with id 'ci_combo' with the following setting:
- Roles - All
- Resource Class - project
And now, create a topic selector with id 'topic_selector' and:
- Advanced Filter JSON - {'name_status': 'New'}
- Filter field - ci_combo
- Filter data - system
With this filter, after selecting a project, we obtain all the topics that has the project in status 'New'.
Inline editing¶
The filter is also applied when the Resource Combo is edited inline from the
topic summary view, not only in the full topic edit form. The list of resources
offered is constrained by the current value of the Filter field, and when that
field is empty the combo stays empty instead of offering every resource.
Editing combo chains inline¶
When several fieldlets are linked through Filter field/Filter data they form
a combo chain: each field filters the next one (for example
servicio_nivel_1 → servicio_nivel_2 → servicio_nivel_3).
Editing a single field of the chain in isolation could leave the dependent fields inconsistent — for instance changing the parent value without re-checking the children. To prevent this, clicking the inline edit button on any field that belongs to a chain opens all the fields of the chain together. Changing a parent value immediately re-filters (and clears) its dependent fields, and pressing Save stores the whole chain at once, so the combined values always stay consistent.