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_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to