Module: alfresco/lists/AlfFilteredList

alfresco/lists/AlfFilteredList

This extends the AlfSortablePaginatedList to provide support additional filtering of the displayed items. This widget does not perform any client side filtering, it simply controls the payloads published to services - successful filtering is determined by the ability of the service and the REST API ultimately called to support it.

The widgets to control the filters should be defined in the widgetsForFilters and these will be rendered above the list. The widgets will typically be form controls (for example a TextBox might be used to allow the user to enter text that an item property must match to be displayed). As well as defining the widgets it is also necessary to configure the filteringTopics that they will publish. When one of these topics is published the list will make a new request for updated data based on the changed filter value.

It is possible to also display a summary of the currently applied filtered by configuring showFilterSummary to be true. This will provide an at a glance display of all the filters currently in user. Filters can also be derived from and set on the browser URL hash by configuring useHash to be true.

Author:
  • Dave Draper
License:
Source:

Example

A list of users with an additinal text box for filtering the results.

{
  name: "alfresco/lists/AlfFilteredList",
  config: {
    loadDataPublishTopic: "ALF_GET_USERS",
    filteringTopics: ["_valueChangeOf_FILTER"],
    widgetsForFilters: [
      {
        name: "alfresco/forms/controls/TextBox",
        config: {
          fieldId: "FILTER",
          name: "filter",
          placeHolder: "Enter filter text...",
          label: "Name"
        }
      }
    ],
    widgets: [
      {
        name: "alfresco/lists/views/HtmlListView",
        config: {
          propertyToRender: "userName"
        }
      }
    ]
  }
}

Members

_filterWidgets :Object[]

The filter widgets
Type:
  • Object[]
Source:

addFilterValueSubscription :boolean

Indicates whether or not all filter widgets will have their configuration updated to set their valueSubscriptionTopic to be a [topic]{@link module:alfresco/core/topics#FILTER_VALUE_CHANGE} dedicated to filter value changes. This is done in order to allow removal of filters from the filter summary to reset the filter form control values.
Type:
  • boolean
Since:
  • 1.0.54
Default Value:
  • true
Source:

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/AlfFilteredList.css"}]
Source:

filterDescription :string

If the widgetsForFilters attribute is not overridden then then this is the value that will be assigned to the name attribute of the TextBox that is rendered as the default filter control.
Type:
  • string
Default Value:
  • "filtered.list.filter.description"
Source:

filterLabel :string

If the widgetsForFilters attribute is not overridden then then this is the value that will be assigned to the name attribute of the TextBox that is rendered as the default filter control.
Type:
  • string
Default Value:
  • "filtered.list.filter.label"
Source:

filterName :string

If the widgetsForFilters attribute is not overridden then then this is the value that will be assigned to the name attribute of the TextBox that is rendered as the default filter control.
Type:
  • string
Default Value:
  • "name"
Source:

filterPlaceholder :string

If the widgetsForFilters attribute is not overridden then then this is the value that will be assigned to the name attribute of the [TextBox]module:alfresco/forms/controls/TextBox that is rendered as the default filter control.
Type:
  • string
Default Value:
  • "filtered.list.filter.placeholder"
Source:

filterSummaryLabelMapping :object

This is an optional map of filter values to labels. The map should have filter name attributes that are mapped to a sub-map of values to labels, e.g.
Type:
  • object
Since:
  • 1.0.84
Default Value:
  • null
Source:
Example
filterSummaryLabelMapping: {
  name: {
    ted: "Edward",
    bob: "Robert"
  },
  age: {
    10: "Ten",
    20: "Twenty"
  }
}

filterUnitsLabel :string

If the widgetsForFilters attribute is not overridden then then this is the value that will be assigned to the name attribute of the [TextBox]{@link module:alfresco/forms/controls/TextBox} that is rendered as the default filter control.
Type:
  • string
Default Value:
  • "filtered.list.filter.unitsLabel"
Source:

filterWidgetsMappingId :string

This is the string that is used to map the call to processWidgets to create the defined filters to the resulting callback in allWidgetsProcessed
Type:
  • string
Since:
  • 1.0.35
Default Value:
  • "FILTERS"
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/AlfFilteredList.properties"}]
Source:

showFilterSummary :boolean

If this is configured to be true then a filter summary widget will be added above the list.
Type:
  • boolean
Since:
  • 1.0.54
Default Value:
  • false
Source:

summaryWidgetsMappingId :string

This is the string that is used to map the call to processWidgets to create the [filter summary widget]module:alfresco/lists/utilities/FilterSummary to the resulting callback in allWidgetsProcessed
Type:
  • string
Since:
  • 1.0.54
Default Value:
  • "FILTER_SUMMARY"
Source:

widgetsForFilters :array

This is the default widget model for the filters and defines a single text box that can be used as a filter. This can be overridden with any number of filters that are required.
Type:
  • array
Source:

widgetsForFilterSummary :object[]

The default model for rendering a [filter summary]{@link module:alfresco/lists/utilities/FilterSummary}. This will only be used if showFilterSummary is configured to be true.
Type:
  • object[]
Since:
  • 1.0.54
Source:

Methods

_storeFilterWidgets()

Build a collection of filter widgets as a property on this instance
Source:

_updateFilterFieldsFromHash()

Update the filter form fields using the filter values in the hash, and update the dataFilters property at the same time.
Source:

allWidgetsProcessed(widgets, processWidgetsId)

Extends the inherited function to handle differentiate between filter widget and view widget post creation processing.
Parameters:
Name Type Description
widgets object[] The widgets that have been created
processWidgetsId string An optional ID that might have been provided to map the results of multiple calls to processWidgets
Since:
  • 1.0.34
Source:

hideChildren(targetNode)

Extends the inherited function to ensure that the filter controls aren't hid.
Parameters:
Name Type Description
targetNode object The node to hide the children of
Source:

onFilterRemoved(payload)

This function can be extended in order to perform additional actions when filters are removed.
Parameters:
Name Type Description
payload object The filter item that was removed.
Since:
  • 1.0.54
Support:
  • This function is safe to be overridden by extending or mixing modules (at least until the next major release). The inherited code must be called in the overriding function and if the inherited function returns a value then that value must be returned by the overriding function.
Source:

onFiltersUpdated()

Extends the inherited function to publish information about the new filters that are applied to the list.
Since:
  • 1.0.54
Source:

onHashChange(payload)

We need to make sure any filters in the hash are populated into the dataFilters property
Parameters:
Name Type Description
payload object The publication topic
Source:

postCreate()

Source:

postMixInProperties()

Called after properties mixed into instance
Source:

setupFilteringTopics(filter)

Setups up the filteringTopics for the encapsulated list.
Parameters:
Name Type Description
filter object The widget to find a topic from (expected to be a form control)
Source: