Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to get an index from DataTable's row key #2587

Closed
barisione opened this issue May 16, 2023 · 2 comments
Closed

No way to get an index from DataTable's row key #2587

barisione opened this issue May 16, 2023 · 2 comments

Comments

@barisione
Copy link

I would like a public API equivalent to table._row_locations.get(row_key).

One use case, for instance, is adding content from some other data structure, then select a row/cell. move_cursor accepts indices, so how to I use that?
An option is to use enumerate and count the rows I'm adding, but that's not very nice and doesn't work in conjuction with sort which makes the indices I got from enumerate useless.

Textual Diagnostics

Versions

Name Value
Textual 0.24.1
Rich 13.3.5

Python

Name Value
Version 3.10.1
Implementation CPython
Compiler Clang 13.0.0 (clang-1300.0.29.30)
Executable /Users/bari/.pyenv/versions/3.10.1/envs/undo-core-venv3.10/bin/python3.10

Operating System

Name Value
System Darwin
Release 21.6.0
Version Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64

Terminal

Name Value
Terminal Application iTerm.app (3.5.0beta10)
TERM xterm-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=178, height=45
legacy_windows False
min_width 1
max_width 178
is_terminal False
encoding utf-8
max_height 45
justify None
overflow None
no_wrap False
highlight None
markup None
height None
@github-actions
Copy link

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

trav-c added a commit to trav-c/textual that referenced this issue Jul 1, 2023
…ze#2586)

Added DataTable.get_cell_coordinate
Added DataTable.get_row_index (Textualize#2587)
Added DataTable.get_column_index
@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant