• 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
Expanding items in NSOutlineView with Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Expanding items in NSOutlineView with Core Data


  • Subject: Expanding items in NSOutlineView with Core Data
  • From: Ross Winn <email@hidden>
  • Date: Sat, 6 Aug 2005 11:08:36 -0700

I am having difficulty with the exact same issue as was discussed in this thread. The solution, however, was not posted. So I am at a loss...

I have a NSOutlineView that is being populated by bindings from core data. In my data model I have an attribute that says if the item should be expanded or not. I know how to expand the items, but if I try and do it in outlineView: willDisplayCell: (etc) it just overwrites the other values in the NSOutlineView's root level. (please see below for more clarification).

The solution was described as "external method of expanding/ collapsing rows" but I'm not sure how to go about calling an external method after the NSOutlineView has been populated.

Any suggestions are appreciated!

- Ross




Hello,

I have a bunch of items in an NSOutlineView. I have implemented my own
trivial system to store their settings, like the expanded / collapsed
state, et.c. When the NSOutlineView is about to be displayed I check
which items should be expanded in this method:

- (void)outlineView: willDisplayCell: forTableColumn:item:

and call the [outlineView expandItem:item] / [outlineView
collapseItem:item] appropriately.

Now, the problem - as has been described previously on macosx-dev - is
that the outline view seems to have decided how many items to display
beforehand, and doesn't update that value based on wether I later
expand / collaps items or not. The result is that the list of items in
the outline view is cut off after the number of top level items.

Does this make sense?  ;)
I think that Richard Schreyer described it better then I do:

On onsdag, februari 21, 2001, at 04:29 , Richard Schreyer wrote:
> When I call reloadData after some change, the Outline View asks for the
> number of items on the top level, and then only displays that number of
> expanded items, cutting off the list halfway through (I might only have
> 5 top level items, but 9 total items that need to be displayed when
> things are expanded.).
> Resizing (and in this case, the drawer containing the outline opening)
> the view causes the missing items to appear.
> I've tried sending setNeedsDisplay:YES to the outline view right after
> sending expandItem, but this had no effect.
> Is there a way I can get the outline view to redisplay itself after it
> creates new items?


Solutions to this problem, anyone? Should I change the expanded /
collapsed state on items somewhere else in the delegate / data source?
I think that you are supposed to be able to have the expanded /
collapsed state stored if you use the itemForPersistentObject /
persistentObjectForItem methods for the outlineView, but I cannot use
them in my app because of my data model that needs to be more flexible.


Regards,

j o a r
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Doing a NSFetchRequest on a single NSManagedObject
  • Next by Date: Re: Doing a NSFetchRequest on a single NSManagedObject
  • Previous by thread: Re: perl string handle equivilents in cocoa
  • Next by thread: Save authentication to keychain
  • Index(es):
    • Date
    • Thread