I’m using backbone.js. I get an event from the server that needs to update a particular instance of a model in a collection of models.
Should I set the id attribute to achieve this, how do I target a model by its id?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
yes, every model should have a unique id.
when you get the update from the server, find the model via the
getmethod on the collection.as a very simple example:
do you have a specific scenario you’re trying to support, tho? the details may change the answer