question
How can the update be backbone in re-render on model change?
I currently have an event listener, listening to such changes.
this.listenTo (this.model, 'change', this.render);
This will then render the scene correctly, though classname & amp; Models are not updated to reflect changes, they look like this.
className: function () {var childClassName = (null === this.model.get ('parent_id')? '': 'List item-child'), parentClassName = (false == this.model.get ('parent')? '': 'List-item-parent'); Return 'list item' + childClassName + parentClassName; }, Attributes: function () {return {'data-id': this.model.get ('id'), 'data-parent': this.model.get ('parent_id')},
For example:
You must update yourself:
OnRender: function () {this. $ El.removeClass () AddClass (this.className ()); }
Comments
Post a Comment