1
votes

I've researched similar questions on SO, but can't find a solution to my issue. I have a NSTableView in my Cocoa bindings app. When I select a row and press the delete button (I've linked remove button to the arrayController) the last row in the array deletes. No matter what row is selected the last row always deletes. I want the selected row to delete rather than the last one.

I've checked the table view connections and bindings for 'Select Indexes' is connected to 'selectionIndexes'. What might I be missing to make this work?

Thanks for the help

2
Can you add your code here? Especially your table view controller implementation.Szu
I've created the tableview and buttons with binding. What I'd like to understand is can be implemented with bindings, or if I need to create a custom class, or something else?user3411663

2 Answers

0
votes

It works with selected item without selected index connection. I created example project just for your case. Send me private message with email where to send it.

To debug try to overwrite setter to determine if it is called:

- (void)setSelectionIndexes:(NSIndexSet *)selectionIndexes{
      _selectionIndexes = selectionIndexes;
      NSLog(@"called");
}
0
votes

My issue was under Selection Indexes my controller key was 'arrangedObjects'. When I changed it to 'selectionIndexes' it worked properly.