I have a bobox that due to its nature it initializes without any item selected (figure 1). When I select an item, the selection is set (figure 2). Then, I have a button that when pressed it should make that bobox back to the first state, without any selection visible, "blank" basically (figure 1).
How can I get the button back to it's initial stage when a button is pressed?
figure 1
figure 2
I have a bobox that due to its nature it initializes without any item selected (figure 1). When I select an item, the selection is set (figure 2). Then, I have a button that when pressed it should make that bobox back to the first state, without any selection visible, "blank" basically (figure 1).
How can I get the button back to it's initial stage when a button is pressed?
figure 1
figure 2
Share Improve this question asked Feb 24, 2017 at 14:08 Diogo MagalhãesDiogo Magalhães 4612 gold badges10 silver badges19 bronze badges3 Answers
Reset to default 2try using smth like this in ur onPressButton function:
this.getView().byId("urComboBoxID").setValue(null)
it should now be initial
When button is pressed you can write in your controller:
var oComboBox = this.getView().byId("yourComboBoxId");
oComboBox.setSelectedKey("A");
And you can define key in you xml file:
<ComboBox id="yourComboBoxId" selectedKey="A" width="150px">
<core:Item text="" key="A" />
<core:Item text="B" key="B" />
<core:Item text="C" key="C" />
<core:Item text="D" key="D" />
</ComboBox>
EDITED 16:14 240217:
Example.
try this:
_YourCombobox.setSelectedKey("");