Re: help with a tableView dataSource
Re: help with a tableView dataSource
- Subject: Re: help with a tableView dataSource
- From: Tito Ciuro <email@hidden>
- Date: Sun, 14 Sep 2003 16:09:41 +0200
Theodore,
Look at:
http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/
Tasks/UsingTableDataSource.html
In particular:
- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
You can pick the value changed, the column (if you've set the
tableColumn after a column name) and the row. Everything you need to
construct your SQL statement.
-- Tito
On Sep 14, 2003, at 3:26 PM, Theodore Petrosky wrote:
I have a table that has a 'normal' array of dictionary
objects as its source. I am using the normal
objectValueForTableColumn and setObject to populate
the table and setObjectValue to update the data
source.
my problem is that the array is not the final resting
place... I populate the array from a postgresql
database. so my order of event is..
1. get data rows from db
2. create the array of dictionay objects from database
3. populate the table
4. on update of a (row, column) let the normal
setObjectValue update the datasource.
5. pick up the index of the changed row and find it in
the array to create the sql to update the db.
here's the problem.. when to fire my code to update
the db. I have tried tableViewSelectionIsChanging and
tableViewSelectionDidChange
I have tried to maintain an instance variable with the
row number textDidChange, then when
tableViewSelectionDidChange since I have the row index
of the row that was being edited, use it to create the
sql.
It appears that tableViewSelectionDidChange is firing
before the datasource is internally updated.
I need some ideas. I need to update the db. I am
starting to think I need to put the changed text into
a instance variable. Just let the system maintain
itself and not try to get the values from the array.
OK I just tried to have the tableView respond to the
textDidChange notification. I think this could work.
as text is 'changing' in the tableView I am updating
an instance variable. problem is that as you type in
the textField in the tableView, nothing shows on the
screen. I see that insertion point moving as if i were
typing spaces. When i click off or tab away, the
correct text is displayed.
Or am I barking up the wrong tree. Someone must have
experience with this kind of thing.
I have spent too much time on this......
Ted
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.