The problem here is when you may want to use both. Say you do a join
on 2 tables with links. It would be nice to have the FormBuilder
integration in this case to pull the linked records and display a nice
value (instead of an id), but if you "turn on" FB integration you
lose the join.
In my case, I am only using joinAdd() to turn ID's into "nice values". How do you "turn on" FB integration with DG to automatically do this?
Or maybe I'm making this too hard. Try something like this:
$obj1 = DataObject::factory('X');
$obj2 = DataObject::factory('Y');
$obj1->joinAdd($obj2, 'LEFT');
$obj1->fb_fieldsToRender = array_merge($obj1->fb_fieldsToRender,
$obj2->fb_fieldsToRender);
$dg =& new Structures_DataGrid(15);
$dg->bind($obj1);
Seems like the array_merge() would do the trick. That said, once I start using $dg->addColumn() it seems logical that any column name I specify should be added to the "fields to render" array (which I think is actually $dg->_dataSource->_options['fields'] ?). The fact that DG uses FB fields is great, but as far as I can tell there isn't an easy way to override the fb_fieldsToRender array to display other columns that might be in your DO.
Basically, from an outsider/newbie perspective of using DG for the first time I was very confused as to why DG was ignoring a column/property name in my DO that I had explicitly asked DG to display by specifying it via $dg->addColumn(). Anyhow, I don't say any of this to offend - just hoping to offer some constructive criticism on what is a great base of code to work with.
- Jamie