cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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

gregorw
Active Contributor
0 Kudos

If you would format your question nicely it would be more likely that someone wants to help you.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Thanks I have formatted it to show he code in the right way. I hope it helps.