Skip to content
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

SaveState not working with data-url #238

Closed
uralbash opened this issue Dec 19, 2013 · 4 comments
Closed

SaveState not working with data-url #238

uralbash opened this issue Dec 19, 2013 · 4 comments

Comments

@uralbash
Copy link
Contributor

I use https://github.com/leukeleu/django-mptt-admin
It uses dynamic loading data by URL and saveState by jq cookie, but when I reload the page tree is reset. I think this is due to dynamic loading with AJAX. How can I solve this problem?

@mbraak
Copy link
Owner

mbraak commented Dec 19, 2013

I could not reproduce this error in the exampe project of django-mptt-admin.

Could you try the django-mptt-admin example project?

@uralbash
Copy link
Contributor Author

ok.

When I launch the project for the first time I see:

▼root(edit)
    ►Africa(edit)
    ►Antarctica(edit)
    ►Asia(edit)
    ►Europe(edit)
    ►North America(edit)
    ►Oceania(edit)
    ►South America(edit)

Then I unwrap item "Africa" and get the next tree:

▼root(edit)
    ▼Africa(edit)
        Algeria(edit)
        Angola(edit)
        Benin(edit)
        Botswana(edit)
        Burkina Faso(edit)
        Burundi(edit)
        Cameroon(edit)
        Cape Verde(edit)
        Central African Republic(edit)
        Chad(edit)
        Comoros(edit)
        Congo(edit)
        Congo, The Democratic Republic of the(edit)
        ...

Then I press F5 I come to the first state:

▼root(edit)
    ►Africa(edit)
    ►Antarctica(edit)
    ►Asia(edit)
    ►Europe(edit)
    ►North America(edit)
    ►Oceania(edit)
    ►South America(edit)

This does not work if I not select node of tree, or select parent node.

@mbraak
Copy link
Owner

mbraak commented Dec 22, 2013

I can reproduce this error. It seems that the state is not saved in this situation. I will look into it.

@mbraak
Copy link
Owner

mbraak commented Dec 28, 2013

I'm afraid I cannot fix this.
It seems that django-mptt-admin only looks at the selected node and not at the open nodes. The reason is that the nodes are loaded dynamically and that makes it more difficult to restore the state of the tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants