0

Is there a way to delete a row in a particular column, in NSTableView? If I use the following code:

[self.newsList removeRowsAtIndexes:[NSIndexSet indexSetWithIndex:0] withAnimation:NSTableViewAnimationEffectNone];

All rows with index 0 are deleted (in all columns), that's not what I want. I just want to delete row 0 in column 2. Is that possible?

halfer
  • 19,824
  • 17
  • 99
  • 186
Supertecnoboff
  • 6,406
  • 11
  • 57
  • 98
  • You can't do that. The `objectValue` of a row represents all columns of that row. Wait, you could do that but this requires to *manually* shift the contents of the particular property in the data model (for example copy property foo of row 1 to row 0, row 2 to row 1 etc) and reload the entire table view. – vadian Oct 18 '17 at 21:15
  • @vadian I see, that makes sense. I just wanted to know, because when deleting a column and creating a new one, the row (cell) recycling works incorrectly. I'll look into using ```prepareForReuse``` to fix this. Thanks anyway. – Supertecnoboff Oct 18 '17 at 21:17
  • 1
    You don't need `prepareForReuse` just make sure that all UI elements are set to a defined state. If there is an `if` clause to change a value add an `else` clause to set a default value. – vadian Oct 18 '17 at 21:19

0 Answers0