Can DataTable select multiple rows at once ? #6185
-
|
I.e take this app (copied from the docs): from textual.app import App, ComposeResult
from textual import on
from textual.widgets import DataTable
ROWS = [
("lane", "swimmer", "country", "time"),
(4, "Joseph Schooling", "Singapore", 50.39),
(2, "Michael Phelps", "United States", 51.14),
(5, "Chad le Clos", "South Africa", 51.14),
(6, "László Cseh", "Hungary", 51.14),
(3, "Li Zhuhao", "China", 51.26),
(8, "Mehdy Metella", "France", 51.58),
(7, "Tom Shields", "United States", 51.73),
(1, "Aleksandr Sadovnikov", "Russia", 51.84),
(10, "Darren Burns", "Scotland", 51.84),
]
class TableApp(App):
def compose(self) -> ComposeResult:
yield DataTable()
def on_mount(self) -> None:
table = self.query_one(DataTable)
table.add_columns(*ROWS[0])
table.add_rows(ROWS[1:])
app = TableApp()
if __name__ == "__main__":
app.run()Lets say i wanted to select these two rows: (2, "Michael Phelps", "United States", 51.14),
(5, "Chad le Clos", "South Africa", 51.14),Is there a way to do that ? From looking at the code it doesn't seem so. Any suggestions on how to do this would be appreciated if so |
Beta Was this translation helpful? Give feedback.
Answered by
TomJGooding
Oct 23, 2025
Replies: 1 comment 1 reply
-
|
There isn't any way to select multiple rows in a |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mrllama123
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There isn't any way to select multiple rows in a
DataTableI'm afraid.