Mark
Mark

Reputation: 367

Integrate jquery mobile custom select menu with JSF

I'm trying to convert our existing JSF application for mobile devices by integrating jquery mobile. Specifically, I would like to use the custom select menus so it pops up instead of a dropdown as seen here: http://jquerymobile.com/demos/1.0a4.1/docs/forms/forms-selects.html. JSF offers SelectOneMenu in order to retrieve data dynamically from the backing bean, but this clearly is not the desired effect. Is there a way to populate jquery mobile select dynamically from backing bean? Below is the code without jsf that I want to replace the options with values from backing bean.

Thanks!

<select name="select1" id="select1" data-native-menu="false" data-theme="l">
<option value="option1">option1</option>
<option value="option2">option2</option>
<option value="option3">option3</option>
<option value="option4">option4</option>
</select>   

Upvotes: 2

Views: 749

Answers (1)

Phill Pafford
Phill Pafford

Reputation: 85358

IMHO You should upgrade jQM to version 1.0 and jQuery 1.6.4

Thinking out loud you could try something like this.

Keep the select menu as is (How your application renders the HTML)

You can add the jQM Markup dynamically with something like this:

//refresh and force rebuild
$('select').selectmenu('refresh', true);

Docs:

Upvotes: 1

Related Questions