azicchetti / jquerymobile-router

A router/controller for jquery mobile. Also adds support for client-side parameters in the hash part of the url. The routes handles regexp based routes. This plugin can be used alone or (better) with Backbone.js or Spine.js, because it's originally meant to replace their router with something integrated with jQM.
GNU General Public License v2.0
402 stars 69 forks source link

Add reverse option (as in "reverse" transition) to bC deferred callback #77

Closed lipanski closed 11 years ago

lipanski commented 11 years ago

With version v20130525 one is supposed to call ui.bCDeferred.resolve() inside the bC event in order to resume normal flow. However, data-direction=reverse (or reverse=true) behaviour is lost for all pages going through the bC event handler and getting rescued with resolve().

Solution: added ui.options.reverse in the deferred done callback. Actually shouldn't all ui.options parameters be extended within the same call?

// my solution
$.mobile.changePage(ui.toPage, $.extend({
            dataUrl: ui.options.dataUrl, reverse: ui.options.reverse
          }, extraOpt ));

// better?
$.mobile.changePage(ui.toPage, $.extend({
            ui.options
          }, extraOpt ));
azicchetti commented 11 years ago

Hi, extending ui.options should be the right way to handle this but I have to test it thoroughly because the options property gets automatically enhanced by jQuery Mobile with some "weird" stuff. I want to make sure it isn't messing with the new changePage call.

Thank you very much for spotting the problem!

EDIT: Extending ui.options seems to be causing some issues, I guess I'll just preserve the options listed in: http://api.jquerymobile.com/jQuery.mobile.changePage/

lipanski commented 11 years ago

sounds good, at least for jqm 1.3x