Re: NSTableView with large arrays
Re: NSTableView with large arrays
- Subject: Re: NSTableView with large arrays
- From: Christian Brunschen <email@hidden>
- Date: Tue, 8 Nov 2005 11:52:51 +0000
On 8 Nov 2005, at 11:39, Trygve Inda wrote:
On 8 nov 2005, at 11.27, Trygve Inda wrote:
How should I handle it in Cocoa? In Carbon, all 10,000 records are
never in
memory at once, but all the Cocoa examples I have seen load up an
NSMutableArray with all the table data and use
objectAtIndex:rowIndex to
show it.
Does NSTableView cache data at all?
No, it only requests, and "caches", the visible rows.
How well will it perform with 10,000 rows?
It depends completely on your data source implementation. You can
still make it lazy if you want to. 10.000 rows should be no problem
at all.
So if I ask it to sort, how does this work?
In Carbon, I just detect the current sort column (A or B) and use
the proper
index (since it is all presorted). I never let the DataBrowser do
the actual
sorting.
In Cocoa can I do the same? ie when it asks for row 1, I can
determine it
based on one of my two indexes, but don't let the NSTableView do
any real
sorting.
Yes, you can. look at the NSTableView documentation, specifically
the document titled 'Using a Table Data Source', <http://
developer.apple.com/documentation/Cocoa/Conceptual/TableView/Tasks/
UsingTableDataSource.html>.
Basically, you implement the method
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
to return the number of rows for the table view, and
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
to return the appropriate table view entries, according to whatever
retrieveal method you choose.
Thanks,
Best wishes,
Trygve
// Christian
_______________________________________________
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