A TableView Binding question
A TableView Binding question
- Subject: A TableView Binding question
- From: Motti Shneor <email@hidden>
- Date: Tue, 22 Feb 2011 09:58:10 +0200
Hello everyone.
I have a TableView, connected to an ArrayController, configured to work against a CoreData Entity - the normal way, similar to what you find in the template bindings when you drag an Entity from the data-modelling tool into a View in Interface-Builder.
Let's say the Entity is the venerable "Employees".
Now, I need one of the table-columns, to be bound NOT to a specific attribute of the entity (like firstName or salary) but rather to the entity (managed object) itself.
Of course the "Entity" is not something presentable on the column --- but I specify (and write) a specific ValueTransformer object that should calculate the displayed content from the managed object.
For example -- Think of a ValueTransformer that given an Employee instance, applies some logic and presents either a full name (First name attached to last name) or a nickname if it exists, or ... whatever comes to mind. It needs access to the entity instance, and returns a simple NSString.
I can't get this to work --- because I don't know what to write in the binding of the TableColumn. It seems there is no way to say "Just the entity" within IB's window.
I select the table column.
I Bind to: ArrayController
I set the Controller key to: arrangedObjects
and now... I don't know what to write in the "Model Key Path" field.
I guessed and tried the following values, to no avail. I always get a binding error:
1. Leave the "Model key path" field blank
2. self
3. @self
4. SELF
5. @SELF
6. @""
7. @
I believe something is missing in the visual description in IB. when you bind against the arrangedObjects of the ArrayController, you actually indirectly specify that the array controller instantiates some Enumerator (Iterator) and the Model Key Path is applied to that enumerator. But what key-path do you ask from enumerator to bring back itself?.
I tried to google around, and to read the "Bindings" programing guide, and saw absolutely NOTHING about this. no specification or list of the available "meta" keys.
Here's a snapshot of similar situation:
I have tried to send this message to the list with a screenshot of my IB binding inspector window -- but it was rejected. So here it is again, without attachments this time.
Any hint will be greatly appreciated._______________________________________________
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