On Sat, Aug 30, 2008 at 5:08 PM, marc hoffman <[EMAIL PROTECTED]> wrote: > Hi, > > im seeing an odd issue, maybe someone has an idea? i have an NSTableView on > my form, populated from an array by implementing the > numberOfRowsInTableView: and objectValueForTableColumn:row: methods. i have > some I elements on my form that update (filter) the contents if the array, > and call reloadData:, when they do. > > most of the time, this works fine, and the table view updates > instantaneously. however, some (rare) times, this does not happen, and the > view of the grid does not change when i call reloadData: - however, when i > scroll or even just click on a row, the rows repaint with the new values, or > new rows appear where previously where none (if the data grew). > > any idea what might be happening? i mean, obviously the call to reloadData: > takes fine, else if the table had - say - 3 rows before, it would not know > to paint row five when i click it, right?
That's actually not obvious at all. You must remember that NSTableView stores absolutely no data whatsoever internally. Whenever it needs to know anything about the data that it displays, it asks your data source. It does *not* only query your data source when you send it a -reloadData. (Note that there is no colon on this method's name, as it takes no parameters.) It will also query your data source every time it needs to redraw, perform hit testing, or do anything else which requires knowing what it displays. So then, having the -reloadData call not do anything would explain everything perfectly. It does nothing, so nothing happens. Then later on you click. At this point, the table view does end up querying your data source, which then tells it about the extra rows, and it dutifully displays them. Since you've somehow failed to tell it about those new rows earlier, odd things can happen like having the new data only be partially displayed. So then the question is, why does this -reloadData call fail? The most obvious reason would be that its target is nil. In any case, step through the code in question in the debugger, and hopefully the reason shall be revealed. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]