Search resetting selection in tableview

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2012-10-06T09:36:37Z Indexed on 2012/10/06 9:36 UTC
Read the original article Hit count: 288

I've got an NSTableView bound to an NSArrayController via content and selection indexes. All great so far - content displayed, etc.

enter image description here

Now an NSSearchField is bound to the array controller via filterPredicate and the property of the array content instances that's to be searched.
Searching/filtering the table view works great; table view showing only matching entries.

However, searching resets the selection on the NSTableView if the existing selection isn't in the search results. Worse, not only during the search but after ending the search there's no selection on the table view.

The NSArrayController is set up to Avoid Empty Selection.

Any hints on how to properly configure bindings in this scenario to really prevent an empty selection much appreciated!

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nstableview