I m wondering how one would implement an outline view like the one Xcode 3 is using for the build configuration:
When using an NSOutlineView/NSTableView with bindings and an NSTreeController/NSArrayController, the view s columns get bindings assigned to, not the individual cells, for obvious reasons. If every row in a column uses the same cell, then it s a piece of cake. However if every row (potentially) uses its own cell type (and with that potentially its very own collection of bindings), then things get funky.
Looking at the screenshot one can clearly see that the textfield cell needs just a single binding for "value". While the popup button cell needs at least one for "content", one for "contentValues" and last but not least one binding for "selectedIndex / selectedObject / selectedValue". And the checkbox cell needs a binding for "value" and (probably) one for "title".
How would one accomplish this with as clean (and little) code as possible?
(Or as one might ask: How would Apple have done it?)
…
Here s what I ve tried myself so far:
I provide the appropriate (copied) cells via [outlineView:dataCellForTableColumn:item:] and bind them to the individual data models (from [item representedObject]).
I know the exact amount of data (< 500 rows) being displayed in the outline view, so having one cell per row shouldn t be too much of a memory issue, no?
I got the data to get displayed properly via bindings (yay!) however I m unable to change any of their values. O_o
Apparently the value change simply never gets thru to the data model. Is there more to it than a simple [checkboxCell bind:@"value" toObject:rowModel withKeyPath:@"value" options:nil]? (as this seems sufficient for getting values, but not for setting them accordingly.)
I couldn t find any information on this topic. Lots of info and hints for using custom cells per column, but none for using them on a "per row" basis. :(
This would make some great stuff for a Cocoa tutorial, wouldn t it? ;)