Feature request: Handle multiple options in $navigate #15

Closed
MisterK opened this Issue Dec 19, 2011 · 2 comments

2 participants

@MisterK

Hi,

Firstly, thank you very much for this useful project!

I wanted to point out that, for now, $navigate accepts a single argument in the form ´[transition]:pageId´. It would be great to split this argument into two, the first one still being the pageId and the second one being of the same type of object that $.mobile.changePage accepts as a second 'options' argument, so that we can specify the 'reverse' attribute, the 'role', the 'reloadPage', etc. (as all listed here: http://jquerymobile.com/demos/1.0/docs/api/methods.html).
It would be more coherent to the original jQueryMobile capabilities, though still easily adaptable to a different library (like Sensa Touch). The 'back' transition can still be handled if set in the 'transition' attribute of this second argument.

Thanks in advance,
MisterK

@tbosch

Hi,
yes, you are right.
Could you spare some time to create a pull request? You need to change the following files:

  • src/main/webapp/jqmng/navigate.js: This contains the navigate function itself
  • src/test/webapp/unit/navigateSpec.js: The unit tests for the function.

Please keep in mind to stay backwards compatible by analyzing the arguments of the function for their type, e.i. if the second argument is an object then it's the jquery mobile options object. Otherwise, it's the callback that I added in the latests version of the adapter.

Tobias

@tbosch tbosch pushed a commit that referenced this issue Feb 1, 2012
Tobias Bosch implement #15: allow custom object to pass through jquery mobile chan…
…gePage
1633d5c
@tbosch

Hi,
the syntax is now as follows, if you want to pass a custom object to jquery mobile changePage function:
var obj = {target: 'page2', transition:'pop', ...}
$navigate(obj);

Please note that the additional property "target" is required in the object that is passed in.

Tobias

@tbosch tbosch closed this Feb 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment