NSTableView is not updated on [reloadData]
NSTableView is not updated on [reloadData]
- Subject: NSTableView is not updated on [reloadData]
- From: Alexander Bokovikov <email@hidden>
- Date: Thu, 23 Jul 2009 21:21:30 +0600
Hi, All,
So, I'm continuing :)
I've connected my NSTableView with AppController (in IB) setting
AppController, as NSTableView's datasource. Then I've added a couple
of methods to the AppController to implement NSTableDataSource protocol:
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row;
Also I have a timer in my app, which should recalculate something from
time to time and, as a result of this procedure, table row count (as
well as values) should be updated. onTimer: method is like this one:
- (void)onTimer:(NSTimer*)timer {
//
// here we do some actions, leading to actual changes in the table
content.
//
[myTable reloadData];
}
It all is correct for the first look. Isn't it? Now what is
happening. numberOfRowsInTableView: is called only once, yet before
AppController's awakeFromNib is called. At that moment nothing yet is
initialized (initialization goes in awakeFromNib), so
numberOfRowsInTableView: returns zero.
Nothing happens when [myTable reloadData] is called within onTimer:
procedure. None of delegated methods are called, so my table is always
empty, though new data (of nonzero length) are created.
So, my question is - how to make table view to change its row count
and update the data?
Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden