Closed smukkejohan closed 12 years ago
Il 01/12/2011 17:03, Johan Bichel Lindegaard ha scritto:
I have a route that catches a query string parameter and builds a JQM nested list. This works fine and the url is bookmarkable but when you navigate to the nested part of the list JQM replaces the existing query string with&ui-page=id. This means that if you reload the page it does not find any data, and it means the url is not bookmarkable. Is there a workaround if I would like refreshable bookmarkable nested list on dynamicly generated pages in JQM?
This was a tough one...
I've patched the code but I want to make sure that I didn't break anything, since this is a thing that should be done by jquery mobile itself. I'll push the file with another name (jquery.mobile.router-test.js) on the git, please test it and let me know. I'm not supporting the configuration parameter $.mobile.subPageUrlKey at the moment, so please use the default "ui-page" identifier.
Could you please fill an issue to the jquery-mobile project? I know that they're planning to include support for hash parameters natively, and this is an important scenario they need to take into account. I will gladly participate to the issue thread aswell, once created.
Cheers, Andrea
Thanks for reacting so quickly to this. The new version doesn't work for me though, still same issue. I am using the default subPageUrlKey. I posted the issue over at jquery mobile as well here: https://github.com/jquery/jquery-mobile/issues/3198.
Il 01/12/2011 20:57, Johan Bichel Lindegaard ha scritto:
Thanks for reacting so quickly to this. The new version doesn't work for me though, still same issue. I am using the default subPageUrlKey. I posted the issue over at jquery mobile as well here: https://github.com/jquery/jquery-mobile/issues/3198.
I've seen that you're probably using the parameters in the "wrong" order. Can you please try and swap them, as in:
I'm pushing a test file on the git, if you load it with this hash:
you can see that parameters are preserved during navigation (hopefully).
Cheers, Andrea
There is still an issue, I am getting an error on line 60.
(hasUiPage){
page+=data.toPage.match(/&ui-page=([0-9-]+)$/)[0];
Uncaught TypeError: cannot read property '0' of null
Il 01/12/2011 23:01, Johan Bichel Lindegaard ha scritto:
There is still an issue, I am getting an error on line 60.
(hasUiPage){ page+=data.toPage.match(/&ui-page=([0-9-]+)$/)[0];
Uncaught TypeError: cannot read property of '0' of null
Can you please post an example? That line should fail only when ui-page contains something that isn't a number or the "-" sign (i.e: &ui-page=foo-0). Is it possible?
Yes the value is: NCCRootElement-0 The top list id is 'NCCRootElement' and -0 is appended by jqm assumably because the list element I am trying to expand is the first in the list.
Il 01/12/2011 23:22, Johan Bichel Lindegaard ha scritto:
Yes the value is: NCCRootElement-0 The top list id is 'NCCRootElement' and -0 is appended by jqm assumably because the list element I am trying to expand is the first in the list.
Woops, fixed!
Ok the parameters are preserved now. But JQM doesn't understand it and loads the top level list again.
Il 01/12/2011 23:45, Johan Bichel Lindegaard ha scritto:
Ok the parameters are preserved now. But JQM doesn't understand it and loads the top level list again.
I think that we need a full example to fix this.
I've noticed that even without the router, standard jqm links with &ui-page are not really bookmarkable. They all load the top level list when refreshed.
Am I missing something? Does it work for you? Maybe this is a separate issue with jqm.
Yeah I think you are right. Hope someone will pick it up in the jquery tracker. Not bookmarkable here either: http://jquerymobile.com/demos/1.0/docs/lists/lists-nested.html#&ui-page=0-8
I have a route that catches a query string parameter and builds a JQM nested list. This works fine and the url is bookmarkable but when you navigate to the nested part of the list JQM replaces the existing query string with
&ui-page=id
. This means that if you reload the page it does not find any data, and it means the url is not bookmarkable. Is there a workaround if I would like refreshable bookmarkable nested list on dynamicly generated pages in JQM?BTW: Oterwise really nice work og the jqm Router! -Johan