var max = this.collection.max(function(player) {
return player.get('points');
});
I spent a few hours playing with backbone.js trying to figure out how to check if my max model changes, it was nearly impossible, so I decided to set the models cid as a data-attribute now it seems impossible to check if the data-attribute changes?
I set the attribute like so,
$(this.$el).attr('data-id', max.cid)
When my app re-renders the data-attribute may or may not get a new value. I am really not sure how to check if it changes, I have seen a lot of various dirty hacks and setInterval
functionality but nothing that seemed very clean, so I am hoping someone knows a nice clean way to do this?
Basically I just want control over the element if it renders new data from another model (meaning if another model takes the max value), I need to check the id to confirm that the model is a new version, and run an animation or render it showing that it is a new model.