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
model.save() destroys nested collection #131
Comments
I've encountered the same problem. According to the manual:
So when localStorage serializes the model, it calls A simple solution would be to change the behavior of the model I hope this can help you and future readers. 😄 |
@coire1, I can understand the issue. but can't fix yet. Can you help on this. I meet the same issue on my project |
Hi, it is really an old project but I found the piece of code you need.
|
Hi @coire1, do you happen to have the Backbone version for this? I've synchronised nested collections to the server in Backbone 1.3+ and it's all serialized correctly. If it's fixed upstream, I'll close this ticket. |
Hello @scott-w, the issue for me happened with Backbone |
Hi @coire1 thanks very much for that. I believe Backbone has resolved the issue since then so I'll close this and let anyone comment if they feel it needs to be looked at again. Best regards, |
Hi!
I have a problem with nested collections using your localStorage adapter.
I want so store GPS-Data whereas one GPS-track is represented with one title and many positions.
Positions are defined as a Backbone.Collection:
My data-structure should look like that:
The nesting works fine until i save the complete track with track.save() to localStorage.
Then my PositionsCollection in memory turns into a blank Javascript-Array.
After saving I can't do something like track.get("positions"), which was possible before.
Saving the data to localStorage works. At initialization of my app I'm parsing the json-data like that:
After fetching the data from localStorage everything is fine again.
But I need to keep my positions in memory as a Backbone Collection as well.
Many thanks in advance for your help.
Best
The text was updated successfully, but these errors were encountered: