Auto Filter

From JRapid

Jump to: navigation, search

auto is a filter mode.


Contents

Description

The auto mode of a filter is used for defining simple filter conditions on properties.

A property of the entity by which to filter must be specified and, if the property is of string type, a flag can be used. The flag specifies how the filter will behave. If no flag, the filter searches with the "starts with" criteria. Else, one of two values may be used for this attribute:

  • contains: the value entered to the filter input is contained by the string in the property.
  • exact: the value entered to the filter input equals the string in the property.

Usage

<filter 
       label = LABEL
       name = NAME
       property = PROPERTY
       display = "primary" | "secondary"
       flag = "contains" | "exact"
/>


Example

Adding simple a filter for the "name" property of a Company entity. This filter searches for companies which names start with the entered value. This is the default behavior for filters on properties that do not specify a value for the flag attribute.

<entity label="Company" menu="Menu" name="Company">
        <filter display="primary" label="Name" name="nameFilter" property="name" />

        <property display="primary" label="Name" name="name"/>
        <property label="Address" name="address" type="text"/>
        <property display="secondary" label="Active" name="active" type="boolean"/>
</entity>


Simple filter


If the filter definition adds the flag attribute with value "contains", default behaviour is modified. The filter now matches companies where the name contains the text entered.

<entity label="Company" menu="Menu" name="Company">
        <filter display="primary" label="Name" name="nameFilter" property="name" flag="contains" />

        <property display="primary" label="Name" name="name"/>
        <property label="Address" name="address" type="text"/>
        <property display="secondary" label="Active" name="active" type="boolean"/>
</entity>


Simple filter with flag "contains"


If the filter definition adds flag attribute with value "exact", the entered text must match the whole name for a company in order to show it in the listing.

<entity label="Company" menu="Menu" name="Company">
        <filter display="primary" label="Name" name="nameFilter" property="name" flag="exact" />

        <property display="primary" label="Name" name="name"/>
        <property label="Address" name="address" type="text"/>
        <property display="secondary" label="Active" name="active" type="boolean"/>
</entity>


Simple filter with flag "exact"

See also:

Personal tools