Re: Bindings or datasource for a large NSTableView
Re: Bindings or datasource for a large NSTableView
- Subject: Re: Bindings or datasource for a large NSTableView
- From: Camillo Lugaresi <email@hidden>
- Date: Thu, 26 Jan 2006 19:01:26 +0100
On 26/gen/06, at 16:07, Dado Colussi wrote:
Greg Herlihy wrote:
I would definitely favor bindings over a data source delegate for
efficiency. An NSArrayController does populate the table in a
"lazy" manner.
For example, if often defers data requests until a group of
objects are
about to be scrolled into view..
Of course having the NSArrayControler sort the records would require
accessing all of them. So the strategy in this case would be to
subclass
NSArrayController and implement its
- (NSArray*)arrangeObjects:(NSArray*)objects
method to have the database sort its records based on the
NSArrayController's current sort descriptors.
Greg
Hi Greg,
I don't see how this solves my problem. How does NSArrayController
(or its subclass) know what part of the arrangedObjects an
NSTableView is accessing in order to retrieve records from the
database and manipulate the arrangedObjects on demand? I must be
missing something obvious here.
Override arrangedObjects and return a custom NSArray subclass which
acts as a proxy for the db query result set. The NSTableView will
call its count and objectAtIndex methods as needed, and your
implementation can fetch the requested information.
Camillo
_______________________________________________
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