Я пытаюсь использовать optionselector в html5 -app. Но кажется невозможным получить выбранную опцию (индекс или что-то еще). Я также хочу установить индекс как предопределенный выбор.
Вот мой HTML:
<div class="settingGroup">
<p>Video Transcoding:</p>
<section data-role="option-selector" id="transcodingOptions">
<ul>
<li data-value="0">
<p>no transcoding</p>
</li>
<li data-value="1">
<p>simple transcoding</p>
</li>
<li data-value="2">
<p>full transcoding</p>
</li>
</ul>
</section>
</div>
и JS:
UI.optionselector("transcodingOptions", false);
// always the same index:
console.debug(UI.optionselector("transcodingOptions").selectedIndex);
// seems to get the right data-value (fires three times):
UI.optionselector("transcodingOptions").onClicked(function(e) {
console.debug(e.values);
// save:
localStorage.setItem("transcoding", e.values);
});
// set selectedIndex --> not working:
UI.optionselector("transcodingOptions").selectedIndex = localStorage.getItem("transcoding");
Кто-нибудь знает правильный путь, что я пытаюсь достичь?
Спасибо.