Replies: 2 comments
-
I've attempted to create a quick minimal reproducible example but I can't reproduce this issue. What other updates are you doing in your code when the cursor is moved? from textual.app import App, ComposeResult
from textual.widgets import DataTable
class MyDataTable(DataTable):
BINDINGS = [
("0", "move_column(0)"),
("1", "move_column(1)"),
("2", "move_column(2)"),
("3", "move_column(3)"),
("4", "move_column(4)"),
("5", "move_column(5)"),
("6", "move_column(6)"),
("7", "move_column(7)"),
("8", "move_column(8)"),
("9", "move_column(9)"),
]
def action_move_column(self, column: int) -> None:
self.move_cursor(column=column)
def on_mount(self) -> None:
self.cursor_type = "column"
for col_num in range(10):
self.add_column(f"C{col_num}")
for row_num in range(10):
self.add_row(
*(f"C{col_num}R{row_num}" for col_num in range(10)),
label=f"R{row_num}",
)
class DataTableApp(App):
def compose(self) -> ComposeResult:
yield MyDataTable()
if __name__ == "__main__":
app = DataTableApp()
app.run() |
Beta Was this translation helpful? Give feedback.
0 replies
-
Many thanks for the demo. My code was a little overcomplicated. For example, selecting a new column was triggering a "sort on this column". I've redone it so it just works more like your demo and just selects the column and its working much better now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to use move_cursor() to allow users to press a "1-10" key to select relevant columns. It appears to work but then the label column can't decide whether to appear or not afterwards. Just moving the mouse around will cause it to appear/disappear erratically. It's very weird. Any idea if it is something I am doing or potentially a bug ?
Beta Was this translation helpful? Give feedback.
All reactions