Disable automatic selection of a row after as NSTableView is populated
-
21-08-2019 - |
Question
I have two NSTableViews populated with Core Data that are linked using bindings. When a row is selected in NSTableView1, NSTableView2 is populated and the first row in it is selected. I have registered the NSArrayController that corresponds to NSTableView2 with KVO on its selectionIndex. This is so that when a row is selected in NSTableView2 a method is run. My problem is that when a row is selected in NSTableView1 then the first row in NSTableView2 is selected triggering the method. I would like it so that I can select a row in NSTableView1 and populate NSTableView2 without having a row automatically selected in NSTableView2. How is this accomplished?
Solution
That you are using Core Data is unimportant here. This is strictly a bindings issue.
Turn off "Avoids empty selection" on your array controller.