How to get row_key from row index? #5250
-
Since I'm constantly struggling with DataTable basics, I'll ask upfront without endlessly searching (again) in existing docs and discussions: How can I retrieve the row_key if I only know the index of the row (not sure if that term is correct, let's call it "when I know for example I want the row_key of the very first row (index 0?) in my currently displaying data table) In the end I often would like to access the contents/value of the currently highlighted cell. For example I want a key-press-event to execute an action, what is the basic code to get the cell contents of for example cell at column 3 and row 5:
PS: I (think) I understand by now, that |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I'm very sorry but I was too dumb to search correctly. Is this my answer? #3623 |
Beta Was this translation helpful? Give feedback.
-
It sound like you actually want |
Beta Was this translation helpful? Give feedback.
-
Here is the actual answer to the title, not one modified based on author's original intention. def row_index_to_key(table, index): -> RowKey | None
coordinate = Coordinate(index, 0)
if table.is_valid_coordinate(coordinate):
return table.coordinate_to_cell_key(coordinate).row_key
return None |
Beta Was this translation helpful? Give feedback.
Here is the actual answer to the title, not one modified based on author's original intention.