Re: [SOLVED] NSOutlineView not lazy when expanding items
Re: [SOLVED] NSOutlineView not lazy when expanding items
- Subject: Re: [SOLVED] NSOutlineView not lazy when expanding items
- From: Jerry Krinock <email@hidden>
- Date: Mon, 29 Sep 2014 10:40:35 -0700
To recap where we left off on Sept 19, the issue is that when an item in an NSOutlineView is expanded, its data source receives -outlineView:child:ofObject: once for *every* child, even if the item has 20,000 children but only 20 can fit in the window, causing poor performance if getting the child has a significant cost.
A workaround is to make the data source “lazy”. Method -outlineView:child:ofObject: should create and return a proxy object containing only the passed-in ‘child' and ‘object’ parameters, while the other three NSOutlineViewDataSource methods, which AppKit invokes lazily, get this proxy and do the heavy lifting of fetching or filtering the actual item from the data model.
I’ve modified the demo project to show both “dumb” and “lazy” data sources.
https://github.com/jerrykrinock/NSOutlineViewLazinessDemo
_______________________________________________
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