Network-based data source for NSOutlineViews
Network-based data source for NSOutlineViews
- Subject: Network-based data source for NSOutlineViews
- From: Chris Ridd <email@hidden>
- Date: Mon, 24 Nov 2003 20:29:44 +0000
The same question probably applies to NSTableViews etc, but my particular
problem is with an NSOutlineView.
My data source is an LDAP directory, and I've got a little model object that
holds some information about the entry being browsed, and (lazily) the child
entries if there are any. That is, each request to expand an item will in
the general case require a single-level LDAP search operation, which may not
be fast. My implementation at the moment does a synchronous search
(ldap_search_s), so slow searches will block the UI and cause the dreaded
beachball to appear :-((
However, I can't think of a good way of avoiding this synchronous behaviour.
I won't necessarily know how many children a given entry has until I
actually go and read them all, which takes some non-zero time. NSOutlineView
wants to know the number of children immediately the parent is expanded.
My first idea is that I could lie about the number of children, and at that
point do a search in another thread (etc) which updated the model and sent
notifications or something to tell the view that the number of children has
changed, but that sounds risky.
My other idea is to try and read ahead more, so that expanding one item will
not require a search operation to show the immediate children, but will
instead initiate multiple searches in the background below each of the
children. (ie find the grandchildren). That feels wrong too, because of the
additional and unnecessary searches being sent to the directory.
What kinds of approaches do people use with data sources that require
network accesses? It seems like it would be a common sort of problem...
Cheers,
Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.