The search
event defines a query
parameter that contains the search string that the user entered in the search field. This query
parameter is accessed by calling getParameter("query")
on the oEvent
parameter.
If the search string is not empty, a new filter object is constructed and added to the still empty array of filters. The defined filter searches for the passed search string in the CustomerName
model property. The FilterOperator.Contains
filter operator used in this process is not case sensitive.
The customer table is accessed using the Id you specified in the view. On the table control, the binding of the items
aggregation is accessed to filter it with the newly constructed filter object. This automatically filters the table by the search string so that only the matching items are displayed when the search is triggered.
However, if the query
parameter is empty, the binding will be filtered with an empty array. This ensures that you see all table entries again.