cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Combobox selected value and create a dynamic field based on that ?

former_member511960
Participant
0 Kudos

Hi Experts,

I have requirement where on selecting the dropdown value from the combobox i have create a lable and button dynamically.

Below is the code which i have used to get the selected value but its working

onSelect:function(){
var item = sap.ui.getCore().byId("combo");
console.log("you have selcted"+item.getSelection());
}

Can somebody help me how to get the selected values and generate the fileds dynamically ?

KR,

Anil

former_member511960
Participant
0 Kudos

Hi Jun Wu,

I have managed to get the selected value using below code

var me = this;
var view = me.getView();
var value = view.byId("filtercombo").getSelectedKey();
console.log("you have selcted" + value);

Now how can i create the dynamic fields ? Please suggest


Accepted Solutions (0)

Answers (4)

Answers (4)

UxKjaer
Product and Topic Expert
Product and Topic Expert
0 Kudos

Use the oEvent and you can get the key by var sSelectedKey = oEvent.getSource().getSelectedKey(), or the item by var sSelectedKey = oEvent.getSource().getSelectedItem().


I believe you can even look into the oEvent parameters and get the item from there directly.

former_member511960
Participant
0 Kudos

Thanks Jokob,

i am able to get the selected value now. can you please tell me how can i create the dynamic fields now ?

KR,

Anil

Sharathmg
Active Contributor
0 Kudos

Bind a method to event "change" for the select. WHen you bind a function, include a parameter in the function.

ex: change:onChange(oEvent)

onChange: function(oEVent){

oEvent - This variable will hold selected line/item and other details.

}

junwu
Active Contributor
0 Kudos

use binding

never go to control to get the value

former_member511960
Participant
0 Kudos

Forgot to add the error in Console