John5269257
Posts: 0
Joined: Mon Jun 17, 2013 11:04 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Hi

I have a page that is populated by a generic service on Page show.
All works well, except:
I need to build 'previous and next' buttons, which set some localStorage variables and navigate to the same page to show different data.

I am calling as follows:
Appery.navigateTo(pagename,{
transition:"none",
allowSamePageTransition: true
});

or:
$.mobile.changePage(pagename+".html",{ .... });as above

(I have tried with and without 'transition:"none")

Both attempts return:
Uncaught TypeError: Cannot call method '_trigger' of undefined
jquery.mobile-1.3.0.js:4063

If I use: location.href = pagename + ".html";
the page gets called ok, but I can't accept the flashing transition

Any hints please?

Thanks a lot
John

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Hello! Try do not navigate to the same page. Set localStorage variable and call service to retrieve data. Mapping should replace old data and show new one. Navigating to the same page is not necessary.

John5269257
Posts: 0
Joined: Mon Jun 17, 2013 11:04 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Hi Maryna
I have a service that maps data to the page, the service is triggered on page show. I set some local variables that the service reads, then load the page, which runs the service and is then populated by it.

So if I have place A, and want to go to to the next place B, it seems the right way to do it - set B in local storage then load the page again. is there a better way?
Thanks for your help,
John

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Yes, in fact reload the same page in jqm is not the best practice. It's better to set necessary localStorage variables and invoke service you need or pageshow event (if there are a few actions)preAppery("screenName").trigger("pageshow");/pre

John5269257
Posts: 0
Joined: Mon Jun 17, 2013 11:04 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Thanks for the insight Maryna.

I'm afraid, however, that this is causing other problems -
TypeError Cannot call method 'find' of undefined VM40868:468
This happens right after the service calls settings.success(object)
This works fine when the page is called normally, with navigateTo, so it's something special about the current situation.

Care to rescue me again?
Thanks, John

John5269257
Posts: 0
Joined: Mon Jun 17, 2013 11:04 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Hi
This may be a symptom of another problem - let me dig further. Thanks for your help on this.

John5269257
Posts: 0
Joined: Mon Jun 17, 2013 11:04 am

Navigating to the same page - Uncaught TypeError: Cannot call method '_trigger' of undefined

Fixed - your solution is fine. Thanks again.

Return to “Issues”