FacetFilter

Introduction

The FacetFilter is an advanced filtering tool usually for combined usage together with the Table oder the DataSet. The FacetFilter consists of several FacetFilterLists, each representing an attribute to be filtered. In case of a table such a Facet would typically represent a column. In contrary to the ExactPattern the FacetFilter does not support hierarchies but it can be implemented the way that the several Facets are dependent and will therefore affect each other. As the data for filling the FacetFilter and the according Table comes from the backend the logic how the Facets are affecting each other has to be provided by the backend as well. By default the each FacetFilterList allows multiple selection of entries by holding the CTRL Key while clicking. There is also an "All" entry within each List which represents a filter reset for that attribute.

Example

The following example shows a Table with an integrated FacetFilter consisting of 3 Facets representing the respective 3 Columns of the Table below. Both the FacetFilter and the Table are connected to an array of data via the Data Binding API. After a Filter changes the DataTable and also the other Filters are influenced accordingly. The data shown within the Table is always the combination of all filters chosen. As this Example works with Keys in the FacetFilterLists, different Data arrays were used to provide the data for the Table and for the several FacetFilterLists. Every Select on a List Item sets up a filter which is bound to the Table and triggers a refresh. The filter is set up using a Constructor like this: var oFilter = new sap.ui.model.Filter("brand", sap.ui.model.FilterOperator.EQ, sFilterText);. In addition the selected Items from the other 2 FacetFilterLists have to be merged into this Filter. The final Filter is then bound to the Table: oTable.getBinding('rows').filter(aFilters);. Then the other 2 FacetFilterLists have to be affectde using 2 additional Filters. If an Item from List 1 is selected it has to influence List 2 and 3 using the Filters with ListBinding: oFFL2.getBinding("items").filter(aCrossFilters1); oFFL3.getBinding("items").filter(aCrossFilters2);. This logik could get very complex especially with an increasing number of FacetFilterLists but within a normal scenario the filtering logik comes from the backend which means that the FacetFilter triggers the respective request and gets back the filtered data for the Table and the FacetFilterLists accordingly.

API Documentation

See API documentation