Skip to content

Blank page when calling changePage on dynamically generated page #23

@sergehuber

Description

@sergehuber

Hello,

First of all thanks for the work on multiview, it looks really powerful and actively maintained, which is great. I really believe this functionality should go into the core of JQuery Mobile because it is so essential !

I'm having a real issue. I've started my code using the examples from : http://jquerymobile.com/test/docs/pages/page-dynamic.html before actually integrating with multiview, and all seemed to work fine.

Now I'm trying to get it to work with multiview but whenever I click a link I get a blank page. I've seen that maybe I should specify the pageContainer myself, so I've tried adding that. Right now here is the code I'm using :

    var pageSelector = urlObj.hash.replace(/\?.*$/, "");
    console.log('pageSelector=' + pageSelector + ' node=' + node);
    if (node) {

        if ($(pageSelector).length == 0) {
            console.log("showNodeDetails: unable to find page with selector " + pageSelector + ", aborting rendering !");
            return;
        }
        var $page = renderNode(pageSelector, node);

        // We don't want the data-url of the page we just modified
        // to be the url that shows up in the browser's location field,
        // so set the dataUrl option to the URL for the category
        // we just loaded.
        options.dataUrl = urlObj.href;
        options.pageContainer = $('div:jqmData(id="main")');

        // Now call changePage() and tell it to switch to
        // the page we just modified.
        if (!refresh) {
            console.log("showNodeDetails: Now changing page dynamically...options.pageContainer=" + options.pageContainer);
            $.mobile.changePage($page, options);
        }
    } else {
        console.log("No valid node for " + nodePath + " was found !");
    }

Despite specifying the pageContainer (and I checked by debugging that I to get a valid object), whenever I change the page it becomes completely blank, as if the pageContainer was being ignored or something.

I'd appreciate any help, especially since I have to demo this in two days and would love to give multiview a nice plug :)

Regards,
Serge Huber.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions