documentcloud/backbone — Issue #843: Error in documentation as in how views behave when models are updated?
Author: meryn
Created: 2012-01-06 14:26:55+00:00
State: open

Hi,

I'm relatively new to backbone, so I'm actually turning back to the docs a lot...

> Whenever a UI action causes an attribute of a model to change, the model triggers a "change" event; all the Views that display the model's data are notified of the event, causing them to re-render. You don't have to write the glue code that looks into the DOM to find an element with a specific id, and update the HTML manually — when the model changes, the views simply update themselves.

I think this part needs some work.

> Whenever a UI action causes an attribute of a model to change, the model triggers a "change" event;

This is correct

> all the Views that display the model's data are notified of the event, causing them to re-render. You don't have to write the glue code that looks into the DOM to find an element with a specific id, and update the HTML manually — when the model changes, the views simply update themselves.

I think this is not.
If I understand backbone correctly, achieving this would require something like

```
this.model.bind('change', this.render, this);
```
and perhaps

```
this.model.bind('destroy', this.remove, this);
```

in the view's initialize method.

Note that I actually appreciate the loose (event-based) coupling. The documentation suggests some magic defaults or something, which I cannot find anywhere in the code.