azicchetti/jquerymobile-router

URI parameters are striped out when using new pagebeforechange event

asxjackal opened this issue · 4 comments

Parameters are striped out when using new special pagebeforechange event.

jQueryMobile-router v20130504
jquery.mobile-1.3.1

works fine on jQueryMobile-router v20130416

none-ajaxApp, multipage-template

Hi,
thanks, fixed!

I'm pushing the fix on the git in a few hours as soon as I've finished testing a small feature, but I'll attach the patch here 'cause it's really trivial:

          $.mobile.changePage(ui.toPage, {
            _jqmrouter_handled: true,
            _jqmrouter_bC: true,
            dataUrl: ui.options.dataUrl
          })

I've just added the dataUrl: ui.options.dataUrl parameter.
The patch should be applied inside the bCDeferred.done(function(){ callback.

now how does one refresh the page?
before i could have called

$.mobile.changePage(hash, {
samePageTransition: true,
allowSamePageTransition: true,
transition: 'none',
showLoadMsg: false
});
to reload the page.

how can I re-call the eventhandler to reload the page?

can't understand the use case.
Do you mean a link pointing to the same page?

If that were the case, pagebeforechange is still triggered, although the same-page transition does not happen.

Well, if you want to trigger the event without use of a hyperlink but pragmatically based on some logic or user's interaction, that's why jQuery Mobile has $.mobile.changePage(). For instance pull to refresh.

never mind I think i solved it if I do this to pragmatically refresh the page
$.mobile.changePage(hash, {
samePageTransition: true,
allowSamePageTransition: true,
transition: 'none',
showLoadMsg: false,
_jqmrouter_bC: true,
dataUrl: $.mobile.path.parseUrl(window.location.href).hash
});