New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems reloading a page with page container #7769

Closed
amasniko opened this Issue Oct 10, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@amasniko

amasniko commented Oct 10, 2014

I am trying to refresh a page by reloading it from the server. From what I have been able find in the documentation, the following code should do the trick:

jQuery.mobile.pageContainer.pagecontainer('change', window.location.href, { reload: true });

The first problem is that it does not appear to do anything unless I add "reloadPage: true" into the options even though the documentation says "reloadPage" is deprecated and "reload" should be used instead.

But the real problem is that the reload corrupts my checkbox on the page by replicating its label. I seems that the problem is caused by two copies of the page residing in the DOM simultaneously at least for some period of time and the checkbox ID appears twice during that time.

The test case can be found on at http://jsbin.com/huvoraba/165

@gabrielschulhof

This comment has been minimized.

Show comment
Hide comment
@gabrielschulhof

gabrielschulhof Oct 25, 2014

Contributor

You can avoid this problem by wrapping your checkbox in its label, rather than using an ID and the label's for attribute:

<label><input name="the-checkbox" checked>The Checkbox</label>

I suppose we should document for the reload option that, if your page is to be reload-able you should design it in such a way that the temporary presence of duplicate IDs does not interfere with the process.

I will keep this open for the misbehaving pagecontainer reload option.

Contributor

gabrielschulhof commented Oct 25, 2014

You can avoid this problem by wrapping your checkbox in its label, rather than using an ID and the label's for attribute:

<label><input name="the-checkbox" checked>The Checkbox</label>

I suppose we should document for the reload option that, if your page is to be reload-able you should design it in such a way that the temporary presence of duplicate IDs does not interfere with the process.

I will keep this open for the misbehaving pagecontainer reload option.

@gabrielschulhof gabrielschulhof added this to the 1.4.5 milestone Oct 25, 2014

@gabrielschulhof gabrielschulhof self-assigned this Oct 25, 2014

gabrielschulhof added a commit that referenced this issue Oct 25, 2014

Pagecontainer: Honor both reload and reloadPage during load
Option reload takes precedence over options reloadPage

Fixes gh-7769

gabrielschulhof added a commit that referenced this issue Oct 27, 2014

Pagecontainer: Honor both reload and reloadPage during load
Option reload takes precedence over option reloadPage

(cherry picked from commit 5f622de)

Closes gh-7801
Fixes gh-7769

agcolom added a commit to agcolom/jquery-mobile that referenced this issue Nov 26, 2014

Pagecontainer: Honor both reload and reloadPage during load
Option reload takes precedence over option reloadPage

Closes gh-7801
Fixes gh-7769
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment