Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

active.url is undefined #4202

Closed
mletynski opened this Issue · 13 comments

10 participants

@mletynski

Hi,
After update to latest jqm build im getting an error while trying to display dialog.

"active.url is undefined"

3596: "if ( active.url.indexOf( dialogHashKey ) > -1 && !$.mobile.activePage.is( ".ui-dialog" ) ) {"

@johnbender

@mletynski

I can't reproduce this issue on http://jquerymobile.com/test/ - can you post a jsbin jsbin.com) or jsfiddle (jfiddle.net) example so we can reproduce it?

@mletynski

@johnbender

Sorry for delay. Here is the code: http://jsfiddle.net/GLuwq/6/show/

We are generating pages/dialogs dynamically via backbone and injecting them into body. I attached you a code without backbone just simple injecting page. The bug still exists.

How to reproduce it:
1) click into "Replace page with page" link
2) click into "Replace page with dialog" link

It is working with 1.1.0 version.

@johnbender

@mletynski

I have to take a closer look at this but I believe the timing and data url values are the issue in your example. One thing you might consider having a look at (if you haven't already) is this post

http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/

Which covers the pitfalls of integrating the backbone router with jqm. Post back if that doesn't help you out.

@mletynski

@johnbender
Yeah i know this article very well and i had to disable JQM routing to work with backbone router.

@mletynski

@johnbender
Any progress for this issue ? I just don't want to patch jquery again i have already it patched with this all flickering issues.

@johnbender johnbender was assigned
@jmckinney88

I just ran into this as well. We are using no routing(app is wrapped in phonegap and navigation is internal to the app with dynamically generated content), so the url for our active page is undefined when we attempt to open a dialog.

I am seeing this in the 1.1.1 release on line 3396

@LegendaryClint

I'm also working with JQM and Backbone. Try the following;

    var $view = $(view.el);
    $view.attr('data-url', window.location.pathname + window.location.hash);
    $view.appendTo($.mobile.pageContainer);
@LegendaryClint

Apologies, but this code is required prior to every $.mobile.changePage call in the router. Here is the full function that I use;

changePage: function (view) {
    // Generate view
    view.render();

    // Add new page
    var $view = $(view.el);
    $view.attr('data-url', window.location.pathname + window.location.hash);
    $view.appendTo($.mobile.pageContainer);

    // Switch to new page
    $.mobile.changePage($view, { changeHash: false, reverse: $.data(window, 'reverse') });

    // Reset defaults
    $.mobile.defaultPageTransition = 'slide';
    $.data(window, 'reverse', false);
},

I use $.data(window, 'reverse') to control the direction of the transition, handy for back and home buttons.

@jaspermdegroot
Collaborator

Related PR: #4928

@joshwigginton

Also had the same issue when I switched to 1.1.1, moved back to 1.0.1 and dialogs are now working fine. I have a changePage function that works fine in 1.1.1, but the showDialog function receives the "active.url is undefined".

@andho

I had the same problem, but as custom select menu also uses dialog when the list is too long, now the list shows and I can click the list items, but it doesn't change the selected item.

@rbu

annoying bug, can you please merge the patch?

@dwt

+1 please merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.