I am dynamically creating a dialog that contains a listview and appending it to body when the user navigates to a specific data-role=page. After appending the dialog to body I call
$('#myDialog').dialog();
$('#myList', '#myDialog').listview();
When I call the listview() function I get the following error:
Uncaught TypeError: Cannot read property 'jQuery19105852627926506102' of undefined
The only way I have been able to initialize my listview is to do it during the pageshow event of the dialog, but then the user actually sees the listview items without styling until the listview() function is complete.
Is there any way I can initialize a listview inside a dialog before the dialog has been shown?
Update: I get the same error if I use `$('#myDialog').trigger('create').
#myListinside the#myDialogHTML?$('#myDialog #myList').listview();this way. In your code you're calling.listview()on both dialog and listview.#myListis inside#myDialog.$('#myList', '#myDialog')should be a selector for'#myList'in the context of (inside of)'#myDialog'.listview()method on a listview that is not on the currently active page? I didn't see that anywhere in the jQuery Mobile docs.