Skip to Content
0
Former Member
May 26, 2016 at 11:40 AM

[ComboBox] getSelectedKey()

978 Views

Hi,

I tried to read out the currently selected Key from a simple ComboBox (NOT MultiComboBox!). I refer to this Example: SAPUI5 Explored and this how to get selected values from multi combobox ... | SCN

My Code:

XML

=============

<ComboBox items="{modelCombobox>/}" selectedItem="comboboxSelectedItem" selectedKey="comboboxKey" selectedItemId="comboboxSelectedItemId"

id="comboboxID" placeholder="Date" textAlign="Initial" textDirection="Inherit" maxWidth="100%"

selectionChange="onSelectionChangeCombobox">

<items>

<core:Item key="{modelCombobox>Listitem}" text="{modelCombobox>date}"/>

</items>

</ComboBox>

CONTROLLER

===============

[...]

onSelectionChangeCombobox: function(oEvent) {

console.log(this.getView().getModel("modelCombobox").getSelectedKey()); // not a function

console.log(this.getSelectedKey()); // not a function

console.log(oEvent.getSelectedKey()); // not a function

console.log(this.getModel().getProperty('/selected')); // undefined

console.log(this.getModel().getParameter('changedItem')); // not a function

}

[...]

Every try failed, are there any other thoughts on this? Thanks in advance!