This is an very interesting idea. The only problem I can see is for undoing. I could begin a transaction before showing the view and commit or rollback accordingly. I need to explore the potentials problems of keeping a transaction open for a theoretically long time though. This to cover the cases where the user let the view open and takes a break or even leave for the night...

Thanks a lot Michael this could be a much simpler solution.

Andre Masse



On Nov 1, 2008, at 23:05, Michael Ash wrote:

I don't know if it's compatible with how you want things to work, but
an interesting feature of the NSTableViewDataSource protocol is that
you don't actually need an NSArray backing store at all. You can
instead just get and store data directly to whatever, well, stores
your data.

For example, if you have a directory listing in a table, then you
don't need to fetch the whole directory and store all the pertinent
information in an array. Instead you can just fetch the information
about the Nth file when the table queries it. This has some advantages
in simplicity, and also performance. The table is smart enough to only
ask for items that it actually needs in order to render, so for a
large data set it's only going to ask for the small fraction of items
that are visible. This means that the app doesn't have to pause while
building the directory listing.

In your case, you could hook the table directly up to the database,
bypassing the intermediate representation altogether. When the table
requests an item, query the database and return the data. When the
table updates a value, set the value in the database. As I said, I
don't know if this matches with how you want it to work, but if it
does then it could simplify what you're doing quite a bit.
_______________________________________________

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]

Reply via email to