Array controller, data source question

Another problem where I’m stuck.
I have a table (an array controller)
If I select one row in the table I want to retrieve some data of the previous and next “row” of the data source - not the ones displayed in table view.

Any tip where and how to search?
Stay safe!

Off the top of my head: Calculate the indexes and then ask the array controller for arrangedObjects()'s objectAtIndex:theIndex (or objectsAtIndexes: if you want them together).

Many thanks for the swift reply…

I played around with these things - no success so far.
Probably I don’t understand the ‘Index’ things.

How do I calculate the indexes?

Get the array controller’s selectionIndex(), then it’s a case of +1 and -1.

Thanks again.

I still have no success. Don’t know what I’m doing wrong.
I have:

  • subsData
  • subsArrayController
  • subsTableView

The visible rows in the subsTableView might be filtered.
One row is selected.

Now I need the ‘row’ before and after the selected row from the original unfiltered data to retrieve some data from each which should be displayed leaving the table row selected.

Typing off the top:

set theIndex to subsArrayController's selectionIndex()
set preObject to subsArrayController's arrangedObjects()'s objectAtIndex:(theIndex - 1)
set postObject to subsArrayController's arrangedObjects()'s objectAtIndex:(theIndex + 1)

Sorry I missed the reply.
My question was misunderstood and (therfore) I misunderstood the replies as well. And as said before I misunderstood the ‘index’ thing.
I found simple solution but run into a ‘next’ problem and so I put this problem back to the shelf.