-
Notifications
You must be signed in to change notification settings - Fork 826
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
Add DataTable.move_cursor
#2479
Conversation
Related issues: #2472.
# scrolling because it may be animated. | ||
self.call_next(self._scroll_cursor_into_view) | ||
|
||
def move_cursor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the API here personally, because the parameters are kind of dependent on each other. (e.g. if you pass coordinate
and row
, things get weird). Do we need the coordinate
parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you pass a coordinate and a row, you get an error.
I opted for this signature because if the cursor is a coordinate (DataTable.cursor_coordinate
) it makes sense to accept the same type; then I added row
and column
as convenience parameters, which work similarly to the parameters after
and before
in methods like Widget.mount
and Widget.move_child
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur with Darren here. The signature can be ambiguous. Given there can be row and column cursors, where only a single value makes sense, I think we should drop the coordinate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when the cursor type is row/column, the reactive attribute cursor_coordinate
is a full coordinate with X and Y coordinates, so this is aligned with that.
But if you all think it is a bad idea 🤷
# scrolling because it may be animated. | ||
self.call_next(self._scroll_cursor_into_view) | ||
|
||
def move_cursor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur with Darren here. The signature can be ambiguous. Given there can be row and column cursors, where only a single value makes sense, I think we should drop the coordinate
.
* Tweaks to DataTable docs. Related PRs: #2479. * Fix link.
This will add the method
DataTable.move_cursor
.This also fixes the animation you get when going left/right in a data table.
Closes #2471.
Closes #2472.