cancel
Showing results for 
Search instead for 
Did you mean: 

How to clear ComboBox value on its "Change" event

0 Kudos

I have a ComboBox. I have written a function for its change event, on a particular condition I need to clear the ComboBox selection and its value.

<ComboBox change="onChange"/>
onChange:function(oEvent){ if(someCondition is true){ oEvent.getSource().setValue("") // this trigger the onChange method again //or oEvent.getSource().clearSelection() // this does not clear the value } }

The above solutions have issue mentioned in comment.

Any solution for this ? Or de we have any event which will trigger on ComboBox popup close ?

View Entire Topic
Marian_Zeis
Active Contributor
comboBox.setSelectedKeys()
comboBox.setSelectedItems()

Both does not trigger the change event for me

0 Kudos

We have below methods for combo box

comboBox.setSelectedKey()
conboBox.setSelectedItem()

But we don't have method you commented

comboBox.setSelectedKeys()
combobox.setSelectedItems()

And above both mentioned method triggers change event

Marian_Zeis
Active Contributor
0 Kudos

You´re right, i was at a multicombobox

But i tried here with a comboBox and the Change Event did not trigger:

https://ui5.sap.com/1.84.31/#/entity/sap.m.ComboBox/sample/sap.m.sample.ComboBox
Same with 1.108

0 Kudos

Strangely, it triggered second time for me, when using inside change event. But version 1.71.


view1.txt
view1view.xml