-
Notifications
You must be signed in to change notification settings - Fork 330
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
reverseRelation does not work? #493
Comments
i would also really like to understand that, i have the same "issue" |
That's because when initialize function is called, the model does not have relations yet. you could listen to change:week and call your function: var Day = Backbone.RelationalModel.extend({
initialize: function() {
this.listenTo(this, 'change:week', function() {
alert(this.get('week'));
});
}
}); |
I have a similar issue:
My problem is that my view depends on the inverse relation to pull a field from the parent model, so, #5 needs to happen before #4. Current workaround plan is when I call fetch, stash the current parent model in some global state then get it out in an event attached to my new models being added to the collection. TLDR: Everything should be in place before views render anything, currently not. |
Week HasMany Days with reverseRelation
I want to get Week from any Day, but
day.get('week')
returnsnull
So the code is:
If reverseRelation is not meant to work like that, how can i get this functionality?
PS: Here is the code http://jsfiddle.net/77rmbevw/1/
The text was updated successfully, but these errors were encountered: