I'm thinking about the most elegant way to realize a master-detail
relationship in Pivot 2.0. A common use case for my application is
that there is a master TableView, displaying some entries of a search
result, and a detail form below displaying detailed information about
the selected item of the TableView. That is, something like the
StockTracker demo.
What I don't like about the StockTracker demo is the load/store
approach triggered by a TableViewSelectionListener. I will have _lots_
of master detail panels in my app, and having each of them implement
TableViewSelectionListener.Adapter with the load/store functionality
is just too much repetitive code IMHO.
So I thought about using the new dynamic bind functionality of Pivot 2.0:
<TableView bxml:id="table">
...
</TableView>
<TablePane bxml:id="detailView>
...
<TextInput bxml:id="name" text="${table.selectedRow.name}"/>
...
</TablePane>
but then I realized that dynamic bind only works on bean property
paths that emit change events (understandably). "${table.selectedRow}"
does, but not "${table.selectedRow.name}".
I could use a script performing load:
<TableView bxml:id="table">
...
<tableViewSelectionListeners>
function selectedRangesChanged(tableView, previousSelectedRanges) {
detailView.load(tableView.selectedRow);
}
</tableViewSelectionListeners>
</TableView>
But this doesn't solve Save, only Load, and I would have to repeat the
same code on all master detail panels again.
I would like to have a push in the right direction. Is there some
better/ more elegant way to solve this problem?
Thanks,
Dirk.