SitePen/dgrid — pull request #172 by SitePenKenFranqueiro (2012-05-22 16:59:19+00:00)
Title: Fix #141: option to render trees expanded

This branch implements support for a `shouldExpand` function on the column definition object passed to the `tree` column plugin. The function receives 3 arguments:

* `row` - object for the row being rendered
* `level` - the level of the tree the row is at (0 for top-level)
* `previouslyExpanded` - if this row was rendered previously and later unrendered, this indicates whether the row was expanded earlier

The function should return a boolean determining whether or not to expand the row when rendered.

The [default implementation](https://github.com/SitePenKenFranqueiro/dgrid/blob/tree-expand/tree.js#L17-25) simply preserves the previous expanded state; this is meant to be overridden as seen fit for each particular use case.

Of course, I'd strongly caution *against* blindly returning `true` from this method, or auto-expanding at all beyond the default implementation, especially if you're not using an in-memory store, in which case you'd risk pretty much spamming your server with child requests.