CoreData with OutlineView collapses items on fetch
CoreData with OutlineView collapses items on fetch
- Subject: CoreData with OutlineView collapses items on fetch
- From: peter ljunglöf <email@hidden>
- Date: Tue, 13 Jan 2009 11:33:59 +0100
Hi,
After upgrading to 10.5.6, I got a problem with NSOutlineView and
NSTreeController in my CoreData application. When executing fetch: on
the NSTreeController, deeply nested items (nesting level>=2) collapses
in the NSOutlineView.
I created a minimal XCode project with the same problem, it can be
downloaded from
http://heatherleaf.se/temp/OutlineBug.zip
Open in XCode (I've tried 3.1.1 and 3.1.2), compile and run. Create
some nested items (double-click to rename the item), select the
topmost item and then click the "Fetch" button. E.g., if I create the
following items (where "v" is the expanded triangle and ">" is the
collapsed triangle):
+-----------------------+
| v A |
| v B |
| v C |
| D |
+-----------------------+
Select the A item, and the click "Fetch", I get the following result:
+-----------------------+
| v A |
| > B |
| |
| |
+-----------------------+
Depending on the nestings and which item is selected, the selection
sometimes changes, and sometimes everything is deselected.
Also, none of the following delegate methods get called:
outlineView:shouldCollapseItem:
outlineViewItemWillCollapse:
outlineViewItemDidCollapse:
Does anyone know what the problem is and how I can avoid collapsing my
outline views? I did not have this problem in 10.5.5.
The example project is really simple. I created a new CoreData
Application project. Added one attribute "name" and two relationships
"children" and "parent" (inverses) to the data model. I did not touch
the code at all.
In IB, I added a NSTreeController, with I set to Entity mode, children
key path "children" and fetch predicate "parent==nil". Bound the
Managed Object Context to OutlineBug_AppDelegate.managedObjectContext.
Then I added a NSOutlineView with one column, and bound that column's
Value to TreeController.arrangedObjects.name.
Finally I added three buttons: Fetch, Remove and Add Child, and bound
their sent actions to the TreeController's fetch:, remove:, and
addChild: methods.
That's all.
regards,
Peter Ljunglöf
PS. My original project is of course larger, and can be found at http://code.google.com/p/kronox/
, if someone's interested...
--------- ----- --- -- -- - - - - - - - - -
peter ljunglöf (http://www.ling.gu.se/~peb)
_______________________________________________
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