Merge pull request #1803 from Textualize/datatable-scrollbar-show-header-refresh

Ensure scrollbars update when show_header toggles
This commit is contained in:
Will McGugan
2023-02-16 09:24:31 +00:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
### Fixed
- DataTable scrollbars resize correctly when header is toggled https://github.com/Textualize/textual/pull/1803
## [0.11.0] - 2023-02-15
### Added

View File

@@ -786,7 +786,11 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
elif self.cursor_type == "column":
self._highlight_column(self.cursor_column)
def watch_show_header(self) -> None:
def watch_show_header(self, show: bool) -> None:
width, height = self.virtual_size
height_change = self.header_height if show else -self.header_height
self.virtual_size = Size(width, height + height_change)
self._scroll_cursor_into_view()
self._clear_caches()
def watch_fixed_rows(self) -> None: