mobiscroll dynamically select an option in a spinner/selectmenu

Posted: February 5, 2013 in android, javascript, jquery mobile, mobile, phonegap, snippets

Good day,

I tried for two hours now to figure out how to programically set an option for a selectmenu by mobiscroll. I tried several suggetion found on my google searches and here are my conclusions.

mobiscroll, you need to provide a better api for this. It takes too much time to do this (very very) basic and simple task. WTF.

What i did was to set values with the val() function, than set the mobiscroll functionallity and finally loading the dialog.

$(“#updateDayOfWorkoutPlan”).val(row.dayoftheweek);
$(“#updateTimeOfWorkoutPlan”).val(row.time);
$(“#updateDurationOfWorkoutPlan”).val(row.duration);
$(“#updateAlertOfWorkoutPlan”).val(row.alert);

$(“#updateDayOfWorkoutPlan”).mobiscroll().select();
$(“#updateTimeOfWorkoutPlan”).mobiscroll().time();
$(“#updateDurationOfWorkoutPlan”).mobiscroll().select();
$(“#updateAlertOfWorkoutPlan”).mobiscroll().select();

$.mobile.changePage(“#update-page”);

this is not pretty but got to keep things moving.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s