Re: Binding table columns that change at runtime
Re: Binding table columns that change at runtime
- Subject: Re: Binding table columns that change at runtime
- From: Brent Gulanowski <email@hidden>
- Date: Sat, 5 Sep 2009 10:10:20 -0400
You will probably want to use KVO to observe changes to the array
holding the list of column names to show. You can subclass
NSArrayController. You could go all-out and add support for a new
binding, or the custom controller could just add itself as an observer
of the arranged objects property of the relevant array controller (the
one managing the list of column names). Then implement the KVO
observation method (-observeValueForKeyPath:ofObject:change:context:),
where you will do the right thing depending on whether a column was
added or removed.
On Fri, Sep 4, 2009 at 7:13 PM, BareFeet<email@hidden> wrote:
> On 05/09/2009, at 3:16 AM, Sean McBride wrote:
>
>> On 9/4/09 9:41 AM, BareFeet said:
>>
>>> I'm fairly comfortable with setting up bindings for table columns to
>>> an NSArrayController. Now I'd like to use bindings where the columns
>>> change at runtime. Is this possible? I am avoiding using CoreData (so
>>> I can run on Mac OS X 10.3 ish and upwards).
>>
>> One way to do this is to create all the columns in IB and bind them all
>> in IB. Then at runtime, programatically hide columns as needed.
>
> Thanks for the input Sean.
>
> Two problems with that:
>
> 1. The columns I'm generating are from input data (any SQLite database) so
> the combination of columns is infinite. I can't create infinite columns and
> hide some.
>
> 2. As per my second email I've managed to generate the table columns and
> bind them in code. But now I'm looking for the best way to trigger that code
> when the selection in the boundTo list changes. It would be the same dilemma
> ifI were to hide columns (vs creating them): how do I trigger that in
> bindings?
>
> Thanks,
> Tom
> BareFeet
--
Brent Gulanowski
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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