Mobiscroll select problem

$(‘test’).mobiscroll().select({
onBeforeShow: function (e, instance) {
$(‘test’).option({
data: [{ text: 1, value: 1 }, { text: 2, value: 2 }]
});
instance.refresh();
}
});

The drop-down item will not appear after performing the above code.

Is there another way to add data before Select open?

Hi @Junyoung,

Thanks for the question! The best way would be to set the data at the time of initialization, but it also depends on your use case. Where do you get your data from? Is it available at the time of initialization?
Can you give me some info on why do you want to set the date before the select opens? I would like to get an idea on what you want to achieve.

Let me know your thoughts!
Zoli

Data is obtained from the input field entered by the user.
The data from the three input fields are combined and displayed in the dropdownlist.

Thanks @Junyoung for the details!
In this case you will only need the refresh call. The option call is not needed. You can pass the data as the first parameter to the refresh like this:

onBeforeShow: function (event, inst) {
    var data =  [{ text: 1, value: 1 }, { text: 2, value: 2 }];
    inst.refresh(data);
}

Let me know if that helps!
Zoli