Skip to Content
0
Aug 08, 2023 at 07:36 AM

UI5 - Filterbar with multiple controls having combox and date

72 Views

Dear All

I am having a Filter Bar with a Multi-Combo box, date, and text fields.

I have followed the below sample code.

FilterBar in DynamicPage with a Table - Samples - Demo Kit - SAPUI5 SDK (ondemand.com)

However, the below listed code is creating issues for reading values using "oControl.getSelectedKeys()" for date and text controls enabled over Filter Bar and pushing it to filter 'aSelectedKeys.map(function (sSelectedKey)' .

	onSearch: function () {
			var aTableFilters = this.oFilterBar.getFilterGroupItems().reduce(function (aResult, oFilterGroupItem) {
				var oControl = oFilterGroupItem.getControl(),
					aSelectedKeys = oControl.getSelectedKeys(),
					aFilters = aSelectedKeys.map(function (sSelectedKey) {
						return new Filter({
							path: oFilterGroupItem.getName(),
							operator: FilterOperator.Contains,
							value1: sSelectedKey
						});
					});

				if (aSelectedKeys.length > 0) {
					aResult.push(new Filter({
						filters: aFilters,
						and: false
					}));
				}

				return aResult;
			}, []);

			this.oTable.getBinding("items").filter(aTableFilters);
			this.oTable.setShowOverlay(false);
		},