Re: filtering the values in an NSTableColumn
Re: filtering the values in an NSTableColumn
- Subject: Re: filtering the values in an NSTableColumn
- From: Koen van der Drift <email@hidden>
- Date: Fri, 10 Aug 2012 07:07:40 -0400
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?
- Koen.
_______________________________________________
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