cancel
Showing results for 
Search instead for 
Did you mean: 

MultiComboBox for table filtering in Fiori Elements for OData v4

purplepinguin
Explorer
0 Kudos

I'm using Fiori Elements Templates for OData v4 where I can easily add custom combobox filters for my table using the following example:

https://ui5.sap.com/#/topic/5fb9f57fcf12401bbe39a635e9a32a4e

Now I want to use not a normal `ComboBox` but a `MultiComboBox`, so the `selectedKey` in the example can be changed to `selectedKeys` quite easily. Like so:

<MultiComboBox items="{/Quarters}" selectedKeys="{path: 'filterValues>', type: 'sap.fe.macros.filter.type.Value', formatOptions: { operator: 'com.xxx.ext.controller.CustomFilter.quarterViewFilter' }}">
    <core:Item key="{ID}" text="{ID}" />
</MultiComboBox>

It kinda works in the background, but if I select multiple the value becomes a string separated by commas: "value1,value2", so the `MultiComboBox` doesn't show anything then (as it is an invalid item key).

Also it seems I cannot use `setFilterValues` as shown in the example, with the MultiComboBox's `selectionFinish="handler.setQuartersFilter"` event, as I want to use a more complex `sap.ui.model.Filter` filter .

Does anyone have a solution for this?

View Entire Topic
cd123
Explorer

"sap.fe.macros.filter.type.Value" is only for single value. Since MultiComboBox supports multi values, you cannot use that. Instead, try "sap.fe.macros.filter.type.MultiValue".

<MultiComboBox width="100%" selectedKeys="{path: 'filterValues>', type: 'sap.fe.macros.filter.type.MultiValue'}">
			<layoutData>
				<FlexItemData growFactor="1" />
			</layoutData>
			<items>
				<core:Item key="1" text="1" />
				<core:Item key="2" text="2" />
				<core:Item key="3" text="3" />
				<core:Item key="4" text="4" />
				<core:Item key="5" text="5" />
			</items>
		</MultiComboBox>

Another type supported here is "sap.fe.macros.filter.type.Range". See the examples at https://ui5.sap.com/test-resources/sap/fe/core/fpmExplorer/index.html#/buildingBlocks/filterBar/filt....