Re: NSTableView doesn't show data until I click on a header
Re: NSTableView doesn't show data until I click on a header
- Subject: Re: NSTableView doesn't show data until I click on a header
- From: Keary Suska <email@hidden>
- Date: Sun, 29 Apr 2012 18:45:42 -0600
On Apr 29, 2012, at 6:24 PM, Koen van der Drift wrote:
> I have a follow up question.
>
> One of the columns in the table shows a number (a float), and I have added a min and max value property to my controller to filter the data in the table. I could filter the data every time the user changes the min and/or max values but that means I need to recreate the data every time which is not very efficient. So bindings to the rescue, I thought.
>
> However, NSTableColumn does not have min/max bindings to use. I tried adding an NSNumberFormatter to the column, but there are no min/max bindings for that as well.
Yes, it does, but only if the cell prototype has an NSNumberFormatter attached to it. How did you apply the formatter? Table columns cannot have formatters that I know of. Setting an outlet may not be sufficient, if you are using that approach.
> On Apr 29, 2012, at 12:22 PM, Koen van der Drift wrote:
>
>>
>> On Apr 28, 2012, at 6:21 PM, Keary Suska wrote:
>>
>>> Are you updating the model data in a KVO-compliant way?
>>
>> Bingo! Thanks for pointing that out, I kept looking at my connections in IB, and forgot about the actual code.
>>
>> So for future reference, my data model is an NSMutableArray. Instead of adding objects by calling addObject, I need to call it as follows:
>>
>> - (void)addMyObject:(MyObject *)obj
>> {
>> NSMutableArray *temp = [self mutableArrayValueForKey: @"myArray"];
>> [temp addObject: obj];
>> }
>>
>> And the same for all the other array changing methods.
>>
>> It all works fine now.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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