Subset (attribute of filter)
From JRapid
subset is an attribute of filter.
Contents |
Description
The subset attribute of the filter element is used for restricting the options to be shown in the filter widget.
It needs to work together with the entity attribute of filter, or the filter has to be applied on a property of entity type.
Usage
<filter ... entity = ENTITY subset = SUBSET subsetparams = SUBSETPARAMS ... />
Example
The filter on the city property of the Company entity uses the forActiveCity subset in the City entity. This subset lists the active cities only. Due to this, the options shown in the filter widget on the Company listing are only the active ones.
<entity label="Company" menu="People" name="Company">
<property display="primary" label="Name" name="name"/>
<property label="Address" name="address" type="text"/>
<property display="secondary" entity="City" label="City" name="city"/>
<property display="secondary" label="Active" name="active" type="boolean"/>
<property display="secondary" label="Load Date" name="loadDate" type="date"/>
<filter display="primary" label="City" name="filterCity" property="city" subset="forActiveCity"/>
</entity>
<entity label="City" menu="Places" name="City" order="name">
<subset name="forActiveCity" order="name">
<condition field="active" value="true"/>
</subset>
<property display="primary" label="City" name="name"/>
<property display="secondary" label="Active" name="active" type="boolean"/>
</entity>
This image shows the Company listing with the City filter options expanded and a City listing that confirms that only two records are set to active.

