listview; recreation connects to pages from previous iteration #5902

NigelSwinson opened this Issue Apr 18, 2013 · 1 comment


None yet
2 participants

I'm new here; please be kind.

I am using .listview() to render search results. After the search results change, I container.innerHTML = '' and then .listview() the new contents. I accept there may be a better way to do this without re-building the control and would be happy to receive advice on this topic, but I believe what I'm doing should work.

The problem is that on first invocation of .listview(), _createSubPages() creates a set of pages for the sub items. When I .innerHTML = '' those sub pages remain. On the second invocation of .listview() it then creates a second set of sub pages with the second call to _createSubPages(). This then causes problems as when it is transitioning in/out of the sub page, it makes calls like toggleViewportClass() twice meaning it reverts the original meaning.

I fixed this in my local copy by doing the following:

    refresh: function( create ) {
        this.parentPage = this.element.closest( ".ui-page" );

        // If creating this control; delete any previous pages which may have existed on a previous incarnation of this listview()
        if (create) {


        // As before...

The flaw still exists in jQuery.Mobile 1.3.1 and I'd appreciate someone with more authority reviewing my proposed fix and applying it to a future version.



jaspermdegroot commented Apr 18, 2013


Welcome and thanks for submitting the issue and proposing a fix.
Nested listviews have been deprecated as of 1.3.0 and the feature will be removed in 1.4. Bugs in previous versions won't be fixed. See #5657.
That being said, your workaround seems good to me. I haven't tested it though.
Closing this ticket as won't fix.

PS. Please include a test page that illustrates the bug when submitting an issue. See our contributing guidelines. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment