Re: [Mysql-cocoa-users] Yep, got one ;) - updating a table to disk
Brought to you by:
sergecohen
From: John G. <jo...@jl...> - 2004-07-19 22:13:52
|
Just to echo what Aaron says, it does sound like more of a Cocoa question, and there is an absolute ton of useful information on the Cocoa mailing list archives which are really easy to search, you can find these at http://cocoa.mamasam.com/ I don't actually have my documentation to hand but as Aaron suggests you are probably using the wrong notification, Cocoa has a comprehensive set of notifications and delegate methods that you can use to get as much flexibility as you need. I implemented something very similar to what I think you are talking about here a while ago, and it was actually quite straightforward if memory serves correct. A couple of things I had to deal with were: How to cache the data: ie. I kept a local copy of what I was displaying in my table, the decision I had to make was should I reload the entire dataset for the table when I updated the database, or simply update my local copy at the same time as the remote (db update) - in my application I was able to opt for the simpler more efficient latter option, but there are going to be cases when this won't work. How to get reference to the raw data from the table information: I found I needed to keep additional data in a separate array to keep tabs of database row-id so that when I needed to update a specific piece of data I could do it directly. In fact in the long term I actually created a datastore object that was referenced by the table when needed and contained the hidden data I needed for db updates etc. anyway have fun JOhn On 19 Jul 2004, at 22:57, Aaron Jacobs wrote: > This sounds like more of a Cocoa question than an SMySQL question as > it really has nothing to do with the underlying storage. Either way, > it sounds like you are using the wrong notification. Try looking into > NSControlTextDidChangeNotification. > > > On Jul 19, 2004, at 4:01 PM, John Spicer wrote: > >> Was not sure if this list was even used. Have seen little about using >> this framework. But here goes. >> >> Just staring out to try and get this to work. I have a table loaded >> and displayed in a NSTableView. >> >> I have it registered with the notification center so when a user >> finishes editing a cell, it calls a method called updateTable- the >> idea being that the changes will be written back to the database. >> >> Alas, the notification is being called BEFORE the setObjectValue >> method, so the data is still old (ie I'm getting it from the array of >> NSMutableDictionaries. >> >> Where is the best place to do this? Perhaps right from the the >> setObjectValue method? |