summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-02-12 09:32:46 +0000
committerJoe Carstairs <me@joeac.net>2026-02-12 09:32:46 +0000
commit921b52d1aa05fd6477bab56ba7dab1ab9d699b42 (patch)
tree6d37461f7d7092f44615f89c35e74ee79cf445dd /schist_desktop_gui/src
parent97b413aa5962bded37dedb380034fa7b97bdc06c (diff)
task-085: table is scrollable
Diffstat (limited to 'schist_desktop_gui/src')
-rw-r--r--schist_desktop_gui/src/gui/components/table/view_table.rs18
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()
}
}