• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CoreData with OutlineView collapses items on fetch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CoreData with OutlineView collapses items on fetch
      • From: Ron Lue-Sang <email@hidden>
  • Prev by Date: Re: runModalForWindow, best solution to modal session
  • Next by Date: Re: runModalForWindow, best solution to modal session
  • Previous by thread: Re: runModalForWindow, best solution to modal session
  • Next by thread: Re: CoreData with OutlineView collapses items on fetch
  • Index(es):
    • Date
    • Thread