jquery mobile - Loading select options after setting value -
my program flow requires first set value of select option in viewmodel , load available options viewmodel. causes problems, typically first available option seen in selection list after this, while selected option value stays @ specified value.
i hoping setting new "valueallowunset" help, instead page becomes unresponsive when using it.
therefore set original value again after loading options. strangely, works when set value, set different value , set value again, e.g.
self.data()[field](orgvalue); self.data()[field]({}); self.data()[field](orgvalue);
(i store values multiple selection lists in self.data observable , access them property index "field".)
i tried strip down simple jsfiddle (http://jsfiddle.net/timvdh/hn6de/), behavior not show there, although example pretty resembles actual application. however, using 30 select lists there.
so hoping, can make educated guess goes wrong in application, hoping fact have set original value 3 times maybe gives clue.
edit: fiddle demonstrates, setting selected option before , after filling options list work "valueallowunset": http://jsfiddle.net/timvdh/ht5tp/
i using jquery mobile knockout.js , caused problem (sorry did not think jqm being problem in first place). setting option before filling list , after filling list call
$("#selectmenuid").selectmenu("refresh");
to display option.
the hanging browser not caused knockout, there additional subscriptions selectmenus in app. "valueallowunset" changed behavior of selectmenus , triggered loops caused problems in code.
Comments
Post a Comment