active.url is undefined #4202

Closed
mletynski opened this Issue Apr 25, 2012 · 13 comments

Comments

Projects
None yet
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

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Apr 25, 2012

Contributor

@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?

Contributor

johnbender commented Apr 25, 2012

@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

This comment has been minimized.

Show comment Hide comment
@mletynski

mletynski May 21, 2012

@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

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

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender May 21, 2012

Contributor

@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.

Contributor

johnbender commented May 21, 2012

@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

This comment has been minimized.

Show comment Hide comment
@mletynski

mletynski May 21, 2012

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

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

@mletynski

This comment has been minimized.

Show comment Hide comment
@mletynski

mletynski May 30, 2012

@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
Any progress for this issue ? I just don't want to patch jquery again i have already it patched with this all flickering issues.

@ghost ghost assigned johnbender Jun 17, 2012

@jmckinney88

This comment has been minimized.

Show comment Hide comment
@jmckinney88

jmckinney88 Aug 24, 2012

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

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

This comment has been minimized.

Show comment Hide comment
@LegendaryClint

LegendaryClint Aug 31, 2012

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);

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

This comment has been minimized.

Show comment Hide comment
@LegendaryClint

LegendaryClint Aug 31, 2012

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.

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

This comment has been minimized.

Show comment Hide comment
@jaspermdegroot

jaspermdegroot Sep 3, 2012

Member

Related PR: #4928

Member

jaspermdegroot commented Sep 3, 2012

Related PR: #4928

@joshwigginton

This comment has been minimized.

Show comment Hide comment
@joshwigginton

joshwigginton Sep 23, 2012

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".

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

This comment has been minimized.

Show comment Hide comment
@andho

andho Oct 25, 2012

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.

andho commented Oct 25, 2012

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

This comment has been minimized.

Show comment Hide comment
@rbu

rbu Oct 29, 2012

annoying bug, can you please merge the patch?

rbu commented Oct 29, 2012

annoying bug, can you please merge the patch?

@dwt

This comment has been minimized.

Show comment Hide comment
@dwt

dwt Nov 13, 2012

+1 please merge

dwt commented Nov 13, 2012

+1 please merge

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