diff options
Diffstat (limited to 'schist_desktop_gui/src/gui/components')
| -rw-r--r-- | schist_desktop_gui/src/gui/components/table/view_table.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/schist_desktop_gui/src/gui/components/table/view_table.rs b/schist_desktop_gui/src/gui/components/table/view_table.rs index 1d5f10b..33fa0ef 100644 --- a/schist_desktop_gui/src/gui/components/table/view_table.rs +++ b/schist_desktop_gui/src/gui/components/table/view_table.rs @@ -1,6 +1,8 @@ use std::{fmt::Debug, hash::Hash}; -use iced::widget::{column, container, row}; +use iced::widget::{ + column, container, row, scrollable, scrollable::Direction as ScrollableDirection, +}; use crate::{gui::components::Text, style::SPACING_MD, traits::Viewable}; @@ -13,10 +15,12 @@ where fn view(&'a self) -> iced::Element<'a, Message> { let headers = row(self.cols.iter().map(|col| { container(Text::default(&col.name)) - .width(iced::Length::FillPortion(1)) + .width(iced::Length::Fixed(128.0)) .into() })) + .spacing(SPACING_MD) .padding(SPACING_MD); + let rows = column(self.rows.iter().map(|row_data| { row(self.cols.iter().map(|col| { container( @@ -28,13 +32,19 @@ where }) .unwrap_or_else(|| Text::default("")), ) - .width(iced::Length::FillPortion(1)) + .width(iced::Length::Fixed(128.0)) .into() })) .spacing(SPACING_MD) .into() })); - column![headers, rows].into() + + scrollable(column![headers, rows]) + .direction(ScrollableDirection::Both { + horizontal: Default::default(), + vertical: Default::default(), + }) + .into() } } |
