You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling commit() on a form with more than one updated field, change is triggered on the associated model for each changed attribute.
Backbone allows you to set() many attributes at once on a model. I think this triggers one change event, even when more than one attribute is updated. This allows you to listen to the change event on a model and fire a function.
Should we build a hash of attributes to change and set them all at once in the commit() vs once per field?
My current use case is having a SearchForm with an associated SearchRequestModel. A ResultsCollection references an instance of the SearchRequestModel and has a function bound to the change event that calls a fetch, using the SearchRequestModel's attributes as the parameters to send in the fetch.
Basically, when "submitting" the form, I call commit() on the form, triggering the change on the request model, which triggers the collection's fetch.
The text was updated successfully, but these errors were encountered:
When calling
commit()
on a form with more than one updated field,change
is triggered on the associated model for each changed attribute.Backbone allows you to
set()
many attributes at once on amodel
. I think this triggers onechange
event, even when more than one attribute is updated. This allows you to listen to thechange
event on a model and fire a function.Should we build a hash of attributes to change and set them all at once in the
commit()
vs once per field?My current use case is having a
SearchForm
with an associatedSearchRequestModel
. AResultsCollection
references an instance of theSearchRequestModel
and has a function bound to thechange
event that calls afetch
, using theSearchRequestModel
's attributes as the parameters to send in thefetch
.Basically, when "submitting" the form, I call
commit()
on theform
, triggering thechange
on the requestmodel
, which triggers thecollection
'sfetch
.The text was updated successfully, but these errors were encountered: