.trigger('create') cannot create a listview
Here are the codes I have to dynamically create and enhance a page. The similar pattern has been working for many other kinds, such as text field, button, grid-view, etc. But I found it cannot work with a listview.
- $(document).bind("pagebeforechange", function route(e, data) {
- ...
- $content = $page.children(":jqmData(role=content)");
- var markup = '<ul id="calendarList" data-role="listview"><li>HELLO</li></ul>';
- $content.html(markup);
- $page.trigger('create');
- $.mobile.changePage($page);
- });
I would always get an error message like,
- Cannot read property 'jQuery16409763167318888009' of undefined
Through debugging using Chrome, I found it always fails on the line of $page.trigger('create');