views:

11

answers:

1

Is there any way how i can maintain my own data model of selected items in a NSTableView. I find it either pretty slow or complicated to keep the state of selected items when i update the table model.

A: 

You can maintain your own NSMutableIndexSet for the selected row indexes. If you're binding the table view's columns to an array controller's arrangedObjects and the array controller's contentArray to an array you own, bind the array controller's selectedIndexes to your index set. If you're implementing a data source, be the view's delegate as well and implement the delegate methods relevant to managing the selection.

Peter Hosey