• 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 outline view item ancestry
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Expanding outline view item ancestry


  • Subject: Expanding outline view item ancestry
  • From: Antonio Nunes <email@hidden>
  • Date: Fri, 15 Aug 2008 22:37:01 +0100

Hi,

Although there is a fair number of posts referencing "expandItem" I couldn't quite find this in the archives, although I had expected it to be a fairly common scenario:

I search for an item that belongs to a tree that is shown in an NSOutlineView. When I find the item, I want the outline view to show the it (if it is currently collapsed) and select its row. For that I wrote the following code, that should ensure the selected item's ancestry is expanded, and then selects the targeted item:

while (currentOutline.parent != nil) {
currentOutline = currentOutline.parent;
[clerkDocument.outlinesOutlineView expandItem:currentOutline];
}

[clerkDocument.outlinesOutlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[clerkDocument.outlinesOutlineView rowForItem:match]] byExtendingSelection:NO];


Running this through the debugger I checked that each ancestor of the item gets expanded, and the code executes correctly. However, if several of the ancestors were collapsed, then after this code above is executed the outline only ends up expanding the top previously expanded ancestor, and the targeted item doesn't get selected (because there is no row for item "match" since it is not visible). All the ancestors have been set to expand though.

Is there anything wrong with my understanding of how NSOutlineView operates in this respect, or could this be a bug in NSOutlineView, and if so, is there a workaround?

António

--------------------------------------------------------
Today you are You, that is truer than true.
There is no one alive who is Youer than You.
Today I am Me, and I am freer than free.
There is no one alive who is Me-er than Me.
I am the BEST I can possibly be.

--Dr. Seuss
--------------------------------------------------------


_______________________________________________

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: Expanding outline view item ancestry
      • From: Corbin Dunn <email@hidden>
    • Re: Expanding outline view item ancestry
      • From: Antonio Nunes <email@hidden>
  • Prev by Date: Re: NSCalendarDate has subsecond precision
  • Next by Date: Re: NSCalendarDate has subsecond precision
  • Previous by thread: Re: NSCalendarDate has subsecond precision
  • Next by thread: Re: Expanding outline view item ancestry
  • Index(es):
    • Date
    • Thread