Re: Bindings: changing model changes some views but not others (NSTableColumn)
Re: Bindings: changing model changes some views but not others (NSTableColumn)
- Subject: Re: Bindings: changing model changes some views but not others (NSTableColumn)
- From: "Sean McBride" <email@hidden>
- Date: Thu, 30 Nov 2006 12:49:46 -0500
- Organization: Rogue Research
On 2006-11-29 13:57, Scott Stevenson said:
>> I have an NSTableColumn bound like so:
>>
>> bind to: AppController (NSObject subclass instantiated in the nib)
>> controller key: n/a
>> model key path: polarisMaster.polaris
>> ControlsController.selection.toolsController.arrangedObjects.name
>
>Have you tried binding to an array controller directly in the NIB?
Scott, you are definitely on to something!!!
I took mmalc's ToDos sample and gutted it to be simpler. It still
worked. Then, instead of using the NSArrayController in the NIB I
created one programatically in the MyDocument init method. I have KVC
accessors in MyDocument:
- (NSArrayController *)catController;
- (void)setCatController:(NSArrayController *)aCatController;
Then I change the NSTableColumn binding from:
bind to: Categories (an NSArrayController in the NIB)
controller key: arrangedObjects
model key path: title
to
bind to: File's Owner (MyDocument)
controller key: n/a
model key path: catController.arrangedObjects.title
And changed other bindings analogously. Additionally, I had to bind the
NSTableView's 'content', 'selectionIndexes', and 'sortDescriptors'
bindings as it seems IB does this behind the scenes when the controller
is in the NIB, but not otherwise.
And now I have the same problem as my app! That is, if I change a model
object, the tableview does not update unless I resize the window or
click the tableview. It's as if tableview has simply forgot to redraw.
Text fields update fine, but not table columns.
Shouldn't what I did work?
Thanks,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden