• 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
Re: easy way to refresh branch of NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: easy way to refresh branch of NSOutlineView


  • Subject: Re: easy way to refresh branch of NSOutlineView
  • From: Daniel Jalkut <email@hidden>
  • Date: Mon, 27 Jun 2005 11:17:12 -0700

It's not super easy, but it can be pretty easy. I do something similar to this. It's a matter of remembering the "user expanded" state of each item, so you can selectively auto-expand it after each reload.

In my case, I keep an array of all the expanded items (subscribe to outlineViewItemDidExpand/Collapse). Then, instead of calling reloadData, I call a method "reloadDataPreservingSelection" which simply reloads the data and then goes through the array and expands all the user-expanded items.

There may be a better way!
Daniel

On Jun 27, 2005, at 4:26 AM, Duncan Campbell wrote:

sounds complicated - is there an easy way to do this?

On 27/06/2005, at 9:20 PM, Stephane Sudre wrote:



On 27 juin 05, at 13:13, Duncan Campbell wrote:



My problem:

I am creating a simple file browser using an NSOutlineView. I have it hooked up to be notified when a file changes in a folder that is current being displayed as expanded.

My problem is in re-drawing the appropriate branch when I receive this notification. Because I use a datasource to populate my view, if I force a refresh of a branch, then I lose the state of all the sub-branches (because, obviously they are being re- calculated as new items in the datasource).

Can anyone suggest an idea of how I may accomplish this? I am thinking of something like:

[outlineView reloadItemsWhileMaintainingExpandedState] or something...



Why not just browse the branch and save the expansions state and restore them later?








Duncan Campbell ===================== http://www.duncanandsarah.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com


This email sent to email@hidden


_______________________________________________ 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
  • Follow-Ups:
    • Re: easy way to refresh branch of NSOutlineView
      • From: Corbin Dunn <email@hidden>
References: 
 >easy way to refresh branch of NSOutlineView (From: Duncan Campbell <email@hidden>)
 >Re: easy way to refresh branch of NSOutlineView (From: Stephane Sudre <email@hidden>)
 >Re: easy way to refresh branch of NSOutlineView (From: Duncan Campbell <email@hidden>)

  • Prev by Date: Re: Getting bitmap data out of an CIImageRep
  • Next by Date: Re: Core Data: Binding one NSTableView to another
  • Previous by thread: Re: easy way to refresh branch of NSOutlineView
  • Next by thread: Re: easy way to refresh branch of NSOutlineView
  • Index(es):
    • Date
    • Thread