Re: A CoreData Limitation?
Re: A CoreData Limitation?
- Subject: Re: A CoreData Limitation?
- From: Nicko van Someren <email@hidden>
- Date: Tue, 17 May 2005 20:40:05 +0100
On 17 May 2005, at 19:20, Arthur Schuster wrote:
I am thinking about rewriting one of my applications to make use of
CoreData
...
The current implementation of the application displays data in a
table view, but not only the rows are customizable, the columns are
as well: there are three different cell-types and no limitations on
the number of columns or rows. The data in the cells of one row
form a "data unit", the cells of one column don't really have much
more in common other than their column.
So what you seem to be saying is that you have a set of rows and each
row has a set of cells which may or may not need to be collected
together in columns. Sounds like you need to have entities called
Row, Column and Cell, with Rows having a to-many relationship to
Cells, Columns having a to-many relationship with Cells and Cells
each having a relationship back to a single Row and Column. Then you
make the Row object a custom subclass of NSManageObject and implement
a custom implementation of various bits of key-value coding so that
valueForKey: @"foo" actually does a fetch from the set of cells with
a predicate of cell.column.name == "foo" and insertion with
setValue:forKey: does the right thing too. You'll probably want to
do something observing too. With that in place you should just be
able to bind away and it will work.
Currently, my data model consists of two "root" containers
(arrays): one for the columns, another one for the rows. The
columnArray contains objects that describe NSTableColumns (and
create them on demand---the table view is also created and set up
in code) with title, width, etc. The objects of the rowArray, on
the other hand, contain dictionaries that themselves contain the
actual cell values of the table view. The (of course unique...)
identifiers of the columns are used as keys.
It's not clear to me that you really want a table here anyway. I
appreciate it is a way to present quite a bit of data to the user but
if the cell values along a row really have nothing to do with the
values lined up with them vertically then perhaps a single-column
table to select a row followed by a table to present the cell names
and values would be a better conceptual model.
Nicko
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden