Standard Filter Form

Version Date Notes By
0.1 2017-08-28 Initial release ROB

Intro

This custom component makes the process of adding a filter form to a list much easier while also making the implementation and look the same across all modules.

Using the component

Just include the custom component where the filter form components would go and bind to it the appropriate parameters (See bellow and more details in the parameters section).


<panel-group header-title="form.title.search" collapse-group="collapse-group-search" header-class="bg-slate-300" expanded="false">
    <standard-filter-form
            fixed-form-filter-schema.bind="filterSchema"
            filter-model.bind="filterModel"
            listing-id.bind="listingId"
            datatable.bind="datatable"
            uses-generic-attribute-filter.bind="true"
            model-local-attribute-form-changer-field="doc_family_id"
            model-local-attribute-form-changer-repository.bind="repository.familiesRepository"
            model-local-attribute-form-changer-repository-function="find"
            local-attribute-definition-object.bind="formSchema.localAttributeFilter"
    ></standard-filter-form>
</panel-group>

<panel-group header-title.bind="headerTitle & t">
    <datatable view-model.bind="self" schema.bind="datatable" listing-id.bind="listingId"></datatable>
    <div slot="heading-elements-slot">
        <ul class="icons-list">
            <li>
                <a click.delegate="datatable.instance.reload()">
                    <i class="icon-rotate-ccw3"></i>
                </a>
            </li>
        </ul>
    </div>
</panel-group>

Parameters

Name Type Description
fixed-form-filter-schema FormSchema return (Array of Arrays or Array of Maps) This parameter expects the form schema for the fixed portion of the filter (non dynamic attributes)
filter-model Object Model that contains the filter values (search criteria)
listing-id String Listing id for the filtered list
datatable Object Datatable definition object
uses-generic-attribute-filter Boolean Set to true to use the generic attribute filter system in addition to the fixed form schema system
model-local-attribute-form-changer-field String Name of the filter model parameter that represents the "type" storing attribute definitions for the local attribute filter system
model-local-attribute-form-changer-repository ...Repository Repository instance that can be used to get "type" information (including attribute definitions)
model-local-attribute-form-changer-repository-function String Name of the repository function to call (default "find")
local-attribute-definition-object Object Object containing attribute definition parameters like attributable_fqcn_filter

Adicional considerations

  • fixed-form-filter-schema, filter-model and listing-id are required.
  • datatable is only used for showing the "is dirty" symbol on the containing panel.
  • uses-generic-attribute-filter is set to true to display / use the generic attribute filter system.
  • model-local-attribute-form-changer-field, model-local-attribute-form-changer-repository, model-local-attribute-form-changer-repository-function and local-attribute-definition-object are all required to use the local attribute filter system (if one of them is not set then the system wont be used).