Set DataTable default style to max-height: 100% (#2974)

* Make the default max-height of a DataTable 100%

See #2959

* Fix the demo

Adding `max-height: 100%;` to DataTable has worked everywhere, except in the
demo, where it makes the table just plain flat out disappear. It looks like
it's down to a bug in Textual's CSS, possibly. This fixes the demo for now,
and a standalone issue will follow that dives into what's going on with this
particular combination of container and datatable styling.

* Update the ChangeLog

* Update the FAQ
This commit is contained in:
Dave Pearson
2023-07-25 10:39:39 +01:00
committed by GitHub
parent 0ff435601e
commit 4f3bb3fe15
5 changed files with 10 additions and 0 deletions

View File

@@ -24,6 +24,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Fixed issue with tabs in TextLog https://github.com/Textualize/textual/issues/3007
### Changed
- Breaking change: the default style of a `DataTable` now has `max-height: 100%` https://github.com/Textualize/textual/issues/2959
## [0.30.0] - 2023-07-17
### Added

2
FAQ.md
View File

@@ -265,6 +265,8 @@ If scrolling in your `DataTable` is _apparently_ broken, it may be because your
This means that the table will be sized to fit its rows without scrolling, which may cause the *container* (typically the screen) to scroll.
If you would like the table itself to scroll, set the height to something other than `auto`, like `100%`.
**NOTE:** As of Textual v0.31.0 the `max-height` of a `DataTable` is set to `100%`, this will mean that the above is no longer the default experience.
<hr>
Generated by [FAQtory](https://github.com/willmcgugan/faqtory)

View File

@@ -8,3 +8,5 @@ alt_titles:
If scrolling in your `DataTable` is _apparently_ broken, it may be because your `DataTable` is using the default value of `height: auto`.
This means that the table will be sized to fit its rows without scrolling, which may cause the *container* (typically the screen) to scroll.
If you would like the table itself to scroll, set the height to something other than `auto`, like `100%`.
**NOTE:** As of Textual v0.31.0 the `max-height` of a `DataTable` is set to `100%`, this will mean that the above is no longer the default experience.

View File

@@ -208,6 +208,7 @@ LocationLink:hover {
DataTable {
height: 16;
max-height: 16;
}

View File

@@ -251,6 +251,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
background: $surface ;
color: $text;
height: auto;
max-height: 100%;
}
DataTable > .datatable--header {
text-style: bold;