Re: Implementing NSOutlineView datasource methods when using an asynchronous source?
Re: Implementing NSOutlineView datasource methods when using an asynchronous source?
- Subject: Re: Implementing NSOutlineView datasource methods when using an asynchronous source?
- From: Laurent Daudelin <email@hidden>
- Date: Thu, 4 Feb 2010 19:24:47 -0800
On Feb 4, 2010, at 17:29, Jens Alfke wrote:
>
> On Feb 4, 2010, at 5:12 PM, Laurent Daudelin wrote:
>
>> Just wondering, what kind of design someone acting as a datarsource for an NSOutlineView choose when the source of the data to be displayed is provided by some asynchronous means? What do you return in methods like 'outlineView:numberOfChildrenOfItem:' when the data hasn't been fetched yet?
>
> If you don't know the number yet, return zero, and kick off an async request to get the children (or at least the number of them.)
> When you find out the number of children, tell the outline view to reload the parent item and its children.
>
> The best way to handle getting the children is to return a placeholder object for any child you don't have info for yet, and then make sure you've requested info for that child (you can collect these into batches and request a range of children, if the protocol supports that.) Then when you receive child info, tell the outline to reload the items for those children.
>
> —Jens
Jens,
I thought about that and that's what I'm going to look at. Thanks!
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org
Logiciels Nemesys Software email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries
_______________________________________________
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