Subset (attribute of listing child of entity)

From JRapid

Jump to: navigation, search

A Subset can be used either in Listings or in Properties. When used inside listings, these listings will only display the elements which fulfils the subset's conditions and restrictions. On the other hand, when used inside properties of type entity, these properties will also display the elements which fulfils the subset's conditions and restrictions in their input's field inside the form.

Usage

 <property
           ...
           entity = NAME
           subset = SUBSET
           subsetparams = COLON_SEPARATED_PARAMS
           whennotinsubset = "donotshow | show | shownotvalid"
           ... 
 />
  • "entity": the entity of this property.
  • "subset": the name of the subset.
  • "subsetparams": the subset's colon separated parameters. (See FPath).
  • "whennotinsubset": action to take with the elements which not fulfil with the subset's conditions and restrictions.

Example

The below example uses a subset inside the "State" property to display only the states which belongs to a certain country:

The "State" entity defines a Subset which returns the states for a given country.

<entity label="State" name="State">
        <subset name="subsetForCountry">
            <param entity="Country" name="countryParam"/>
            <condition field="country" value="countryParam"/>
        </subset>
        <property display="primary" label="Name" name="name" type="string"/>
        <property display="secondary" entity="Country" label="Country" name="country"/>
</entity>
<entity label="Address" name="Address">
        ...
        <property entity="Country" label="Country" name="country"/>
        <property entity="State" label="State" name="state" subset="subsetForCountry" subsetparams="country"
 whennotinsubset="donotshow"/>
        ...
</entity>

The "whennotinsubset" attribute is set to "donotshow" so the states which does not belong to the selected country are not displayed.

States for USA
States for Argentina

See also

Personal tools