Mixing TableView Bindings
Mixing TableView Bindings
- Subject: Mixing TableView Bindings
- From: Joe <email@hidden>
- Date: Fri, 5 Feb 2010 14:47:07 -0700
On Feb 5, 2010, at 9:52 AM, email@hidden wrote:
>
>> I have a NSTableView with a column of checkboxes. I have the checkbox value bound to an NSInteger instance in a class which is in an array bound as the content to an array controller.
>
> The checkbox cell should not be bound to anything. (Note: It's a checkbox cell, not a checkbox.) The only way I've ever seen table/array controller "binding" work is to bind the *table column* to the array controller using Controller Key arrangedObjects.
Perhaps I wasn't clear. The checkbox is bound to the array through the table column as it should be.
>
>> When the program starts the column is filled with 16 rows and the checkbox is set to off ... the checkbox column gives the error...
>
> Can't make an array into a BOOL. That's expected, based on the binding you described.
The point is this binding does work as long as there are no other columns bound to managed objects.
>
>> This column is not bound to a core data managed object. The other columns are. I can get rid of this error if I remove the binding on the other columns that are bound to core data managed objects.
>>
>> So, the question is can a TableView have columns where some columns are bound to core data managed objects and others to unmanaged objects? If not, then is there a way to prevent changes to a managed object from causing the document from being tagged as dirty and triggering the "Save" dialog when closing?
>
> It does not matter whether objects are managed objects or not. But what does matter is that all the columns in the table should be bound to the arrangedObjects of the same array controller. I don't see your table would make any sense to the user otherwise. The key paths to which different columns are bound may be mixed "managed properties" and "non-managed properties". The latter may be regular instance variables or derived properties -- anything that is KVC-compliant. Setter may be omitted if the corresponding table column/cell is not editable.
OK, the issue may be that all columns need to be bound using the same array controller. I have two array controllers, one for managed and one for unmanaged data. Since the array controller's "object controller" can be set to a class or to an entity but not both, I don't see how managed and unmanaged data can be mixed.
_______________________________________________
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