0
votes

I have a NSArrayController and NSTableView. All the bindings are working perfectly fine so that when I add a new content to my array, it gets reflected into the table. Perfect. However, upon inserting stuff into the array, the table view looses the currently selected item, which is annoying. I tried to turn this on at the ArrayController by ticking the "Preserve Selection" checkbox but this doesn't help.

How can I preserve the tableview selected row when new content is added to my array?

1

1 Answers

4
votes

So I am going to answer my own question. What you also need to do is to bind "Selection Indexes" of your table to the selectionIndexes key of the ArrayController. Without this, preserving selection won't work.