Re: filtering the values in an NSTableColumn
Re: filtering the values in an NSTableColumn
- Subject: Re: filtering the values in an NSTableColumn
- From: Keary Suska <email@hidden>
- Date: Fri, 10 Aug 2012 06:42:41 -0600
On Aug 10, 2012, at 5:07 AM, Koen van der Drift wrote:
>
> On Aug 9, 2012, at 10:47 AM, Ken Thomases <email@hidden> wrote:
>
>> Better would be to create a property on your controller which returns the predicate, constructing it on demand for each call (perhaps with some smart caching). (I'll call the property "minMaxPredicate" for discussion.) Bind the array controller's filterPredicate binding to that property on your controller. Then, arrange for KVO change notifications to be emitted for the property when the minimum and maximum value properties change. The easiest way to do this is to add a method like the following to your class:
>>
>> + (NSSet *) keyPathsForValuesAffectingMinMaxPredicate
>> {
>> return [NSSet setWithObjects:@"minimumValue", @"maximumValue", nil];
>> }
>
>
> Thanks Ken. I implemented this all, but are having some trouble with the correct syntax for the predicate I'll use for this:
>
> I added this to my Controller loadview method:
>
> self.minMaxPredicate = [NSPredicate predicateWithFormat:@"%f < value < %f", self.minValue, self.maxValue];
>
> Where the float "value" is a property of the entity that I am displaying in the table and self.minValue and self.maxValue are floats bound to my NSTextFields.
>
> But no matter what I try, I get an error "Unable to parse the format string".
>
>
> Any suggestions?
Where in the predicate formatting guide (https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Predicates/predicates.html) does it show that your syntax is in any way valid?
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