Forum Archive

Access to the TableViewCell of a ListDataSource

Gcarver166

I Have TableView using a ListDataSource with an array of dict items containing the title, and accessory_type of detail_button.
I am attempting to get the info button in my TableView to show some detail text. I need to set the text on the TableViewCell.detail_text_label.
ListDataSource.accesssory_action is triggerred correctly but I can't find any way of getting the TableViewCell associated with the activated item. I've looked for them on the root view, the TableView, the ListDataSource and even on my array of ListDataSource items. I was sure the ListDataSource internally creates one of these cells for each of my items but I can't find them.

Is there no way to get access the cells? Do I have to implement my own ListDataSource so I can call tableview_cell_for_row() to create and maintain my own list of TableViewCells?

Thanks.

omz

You can use the tapped_accessory_row attribute of the ListDataSource.

Gcarver166

tapped_accessory_row is just an index. I need the actual TableViewCell.
I'm getting closer. It turns out the cell_for_row() method returns the TableViewCell I need. I was assuming it only created new ones because that is what the example in the docs is doing.

However the detail_text_label is None.
I guess I have to create my own tooltip label.