fponticelli/dhx — pull request #3 by jdonaldson (2012-09-27 00:22:38+00:00)
Title: Add new groupBy selector, and misc. functions

Here's that groupby function I was talking about earlier. This lets you do something like:

```javascript
import dhx.Dom;
class Test {
static function main() {
var d = [1,2,3,4]; // rows
var c = ['foo', 'bar', 'baz']; //columns
var g = Dom.select("#bar").append("table")
.selectAll("tr") // work on rows
.data(d).enter().append("tr")
.selectAll("td") // work on cells
.dataf(function(x,i) return c).enter().append("td")
.text().stringf(function(x,i) return x + ' ' + i);

g.groupBy(function(x,i) return x); // create group selections based on column name
// select groups (which are columns in this case)
// change the background color...
g.selectGroup("foo").style("background-color").string("red");
// add elements to a specific group... difficult to do with current methods:
g.selectGroup("baz").append("input").style("background-color").string("blue");
}
}

```

The main benefit is that you can define multiple selections using one pass through the data and nodes. This makes it easier to make changes that go "against the grain" of a normal hierarchical selection... such as operating on columns, etc.

There may be better ways of addressing this table problem, and the implementation here can probably be streamlined... So, don't merge this yet, just give any thoughts you might have.