Skip to Content
0
May 13, 2020 at 11:42 AM

SAP Fiori Analytical List Page: Combobox set default key/value with aggregate binding

92 Views Last edit May 14, 2020 at 06:31 PM 4 rev

Hello,

I'm developing a Fiori Analytical List Page (ALP) app using Custom filters.

I need the Comboxes by default to select the fist value of the list (based on the aggregation binding), instead of having it empty.

<smartfilterbar:ControlConfiguration key="zdivision" index="1" label="{FilterDivision}" groupId="_BASIC">
<smartfilterbar:customControl > 

<ComboBox id="idDivision" change="onChangeDivision" items="{ path: '/Z_I_DIVISION' }"> 

<items> 

<core:Item text="{Description}" key="{Division}"/> 

</items> 
</ComboBox></smartfilterbar:customControl></smartfilterbar:ControlConfiguration>

I've tried with the GetFirstItem function but it's not working in the launchapd.

onInitSmartFilterBarExtension: function (oEvent) { 

var oCBDivision = this.byId("idDivision"); 

var oFirstItemDiv = oCBDivision.getFirstItem(); 

oCBDivision.setSelectedItem(oFirstItemDiv);
...

Runing from the WebIDE GetFirstItem works when I open the app but afterwards when I change a first combobox to filter a second one, the GetFirstItem doesn't work (I use this to set the first item of the second combobox as the default one).

It gets the first item before the filter was executed.

oPeriod.getBinding("items").filter(oFilter, sap.ui.model.FilterType.Application); 

var oFirstItemPeriod = oPeriod.getFirstItem(); oPeriod.setSelectedItem(oFirstItemPeriod);

Thanks