On Tue, Nov 18, 2008 at 1:42 PM, Kennard Smith <[EMAIL PROTECTED]> wrote: > I'd imagine just setting a dataSource then querying the XML-RPC server for > data when tableView:objectValueForTableColumn:row: is called.
The documentation tells you this is a very bad idea: "Note: tableView:objectValueForTableColumn:row: is called each time the table cell needs to be redisplayed, so it must be efficient." So don't do network round-trips in this method. Get the data first and cache it. > Another curiosity I had was when or does the NSTableView reload its data? The NSTableView knows nothing about its data[1]. That's why -tableView:objectValueForTableColumn:row is called so frequently. It really helps if you look at NSTableView as just a very clever illusion. When parts of the table need to be drawn, NSTableView figures out what rows are in that dirty rectangle and then asks the data source for the data for those rows. > Do I have to tell it to reload periodically? The logical continuation of what I wrote above means "yes." If the contents of a row that's currently displayed on screen change, but NSTableView only asks for data when it needs to redraw, then you'll need to tell it to redraw the affected regions; that's what the -reloadData and related methods are all about. Likewise, once a portion of the table has been drawn, the table view's enclosing NSScrollView (actually its NSClipView) can just copy the drawn regions around as the table is scrolled. This means that once a row has been drawn, simply scrolling it off screen and then back on isn't going to cause it to appear updated. [1] Actually, I have been informed in the past that NSTableView does cache certain details about the data, but what, if anything, it caches is irrelevant. It might just be the bare minimum so that it sets its frame and bounds correctly, or it might be more. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [EMAIL PROTECTED]
