NSOutlineView (Multiple Selection): How to prevent Child Row Deselection on Collapse

I’ve enabled multiple selection in NSOutlineView. When I collapse a parent item, all of its selected child rows get deselected automatically.

Is there a way to prevent this deselection so that selections remain intact when the parent is collapsed and restored when it’s expanded again?

You'll have to do that manually. Maybe add a "selected" flag to each item. Then if an item is expanded, then you can instruct it to re-select any items whose "selected" flag was true.

Remember that an outline view is just a fancy table view. When you collapse and item, those rows are gone, so it isn't possible to maintain their selection within the table itself.

NSOutlineView (Multiple Selection): How to prevent Child Row Deselection on Collapse
 
 
Q