wyuenho/backgrid — pull request #227 by davewasmer (2013-06-11 18:16:44+00:00)
Title: Add a `grid` option to Body and Row for bubbling events up to a Grid

This `grid` option allows custom Row classes to bubble events up to
the containing Grid instance. Because Rows are handled as a simple
array (vs. as a collection), having a Row trigger events on it's
containing Grid would involve lots of overriding methods and event
bookkeeping.

Passing a reference to the containing Grid all the way
down to the Row allows each Row to determine what event should
"bubble" up to the container. For example, now you can patch the Row
to "bubble" all events (namespaced) up to the containing Grid with
just a few lines:

```javascript
var rowInit = Backgrid.Row.prototype.initialize
Backgrid.Row.prototype.initialize = function(options) {
this.grid = options.grid;
rowInit.apply(this, arguments);
this.listenTo(this, 'all', function(eventName) {
this.grid.trigger.apply(this.grid, ['row:' + eventName].concat(arguments.slice(1)));
});
}
```