FROM : Trent Jacobs
DATE : Tue Mar 25 21:15:38 2008
The app I'm writing is centered around a particular list of objects
(for example a list of items in a shop) with various filters allowed.
it's a core data app and I'm using bindings wherever possible.
In the model I'm using I have an entity for my objects and I've set up
relationships to the entities I'll be filtering on (for example brand,
colour, whatever).
I've got everything with perfectly when I hook up the bindings in IB,
i.e. when I select a brand the list of objects is filtered to only
show objects of the selected brand. However, when I try to do the
bindings in code it doesn't work.
To create the bindings I use:
[myObjectController bind : @"contentSet"
toObject : filterController
withKeyPath : @"selection.objects"
options : nil];
where myObjectController and filterController are NSArrayController
objects and selection.objects represents the relationship in the model.
This works fine. However, when I remove the contentset binding I would
expect the filtering to be removed. This doesn't happen. What happens
is that the list of objects stays the same although the controlling
relationship to the filtering array controller is gone, i.e. I change
brands and the list stays constant. To remove the bindings I am simply
using:
[myObjectController unbind : @"contentSet"];
I think this is happening because the NSArrayController is not being
told to refresh but i can't find how to force a refresh.
Any ideas?
Thanks!
DATE : Tue Mar 25 21:15:38 2008
The app I'm writing is centered around a particular list of objects
(for example a list of items in a shop) with various filters allowed.
it's a core data app and I'm using bindings wherever possible.
In the model I'm using I have an entity for my objects and I've set up
relationships to the entities I'll be filtering on (for example brand,
colour, whatever).
I've got everything with perfectly when I hook up the bindings in IB,
i.e. when I select a brand the list of objects is filtered to only
show objects of the selected brand. However, when I try to do the
bindings in code it doesn't work.
To create the bindings I use:
[myObjectController bind : @"contentSet"
toObject : filterController
withKeyPath : @"selection.objects"
options : nil];
where myObjectController and filterController are NSArrayController
objects and selection.objects represents the relationship in the model.
This works fine. However, when I remove the contentset binding I would
expect the filtering to be removed. This doesn't happen. What happens
is that the list of objects stays the same although the controlling
relationship to the filtering array controller is gone, i.e. I change
brands and the list stays constant. To remove the bindings I am simply
using:
[myObjectController unbind : @"contentSet"];
I think this is happening because the NSArrayController is not being
told to refresh but i can't find how to force a refresh.
Any ideas?
Thanks!
| Related mails | Author | Date |
|---|---|---|
| Trent Jacobs | Mar 25, 21:15 | |
| Christiaan Hofman | Mar 25, 23:58 | |
| Trent Jacobs | Mar 26, 09:12 | |
| Christiaan Hofman | Mar 26, 11:27 | |
| Trent Jacobs | Mar 26, 12:00 |






Cocoa mail archive

