Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, well I think I may have answered my own question. I won't mark it as the correct answer right away in case someone can tell me a better way to do this. This way is pretty much a hack.</p> <p>Anyway, I was reading about NSArrayController here: <a href="http://www.cocoadev.com/index.pl?NSArrayController" rel="nofollow">http://www.cocoadev.com/index.pl?NSArrayController</a> which says:</p> <blockquote> <p>If <code>valueForKeyPath:@"arrangedObjects.name"</code> is sent to an array controller, one (as expected) gets back an array of name values, but if another object replicates this behaviour, and the table column's value is instead bound to this object, it will display the entire array for each row.</p> </blockquote> <p>and</p> <blockquote> <p>You bind the value of an <code>NSTableColumn</code> to <code>arrangedObjects.someKey</code>. If you try to programmatically invoke <code>valueForKeyPath:@"arrangedObjects.someKey"</code> on your array controller, you'll get back the array resulting from invoking <code>valueForKey:@"someKey"</code> on the <code>arrangedObjects</code> array -- this is all fine. So one would think that <code>NSTableColumn</code>'s value can also be bound to my objects <code>someArray.someKey</code>, but this will not work (on several levels).</p> </blockquote> <p>So basically it sounds like <code>NSTableColumn</code> special cases its bindings for <code>NSArrayController</code> and <code>arrangedObjects</code> which is why it works the right way, and my custom control doesn't.</p> <p>This doesn't seem very flexible, but it's the only way I can find to make it actually work. I implemented a special case in my bindings for NSArrayController and arrangedObjects and I was able to make it work like I wanted.</p> <p>A better solution would be much appreciated, though!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload