Question
How can in update Backbone el when re-rendering on model changes?
I Currently have an event listener, listening to model changes like this.
this.listenTo(this.model, 'change', this.render);
This will then re-render the view correctly however the className & attributes are not updated to reflect the model 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')
}
},