pub struct Table { /* private fields */ }Expand description
A table viewer.
Designed to be fast when there are millions of rows, but only hundreds of columns.
§Sticky columns and rows
You can designate a certain number of column and rows as being “sticky”. These won’t scroll with the rest of the table.
The sticky rows are always the first ones at the top, and are usually used for the column headers. The sticky columns are always the first ones on the left, useful for special columns like table row number or similar. A sticky column is sometimes called a “gutter”.
§Batteries not included
- You need to specify the
Tablesize beforehand - Does not add any margins to cells. Add it yourself with
egui::Frame. - Does not wrap cells in scroll areas. Do that yourself.
- Doesn’t paint any guide-lines for the rows. Paint them yourself.
Implementations§
Source§impl Table
impl Table
pub const fn max_rows(self, max_rows: u64) -> Self
Sourcepub const fn num_sticky_cols(self, num_sticky_cols: usize) -> Self
pub const fn num_sticky_cols(self, num_sticky_cols: usize) -> Self
How many columns are sticky (non-scrolling)?
Default is 0.
Sourcepub fn headers(self, headers: impl Into<Vec<HeaderRow>>) -> Self
pub fn headers(self, headers: impl Into<Vec<HeaderRow>>) -> Self
The count and parameters of the sticky (non-scrolling) header rows.
Sourcepub const fn auto_size_mode(self, auto_size_mode: AutoSizeMode) -> Self
pub const fn auto_size_mode(self, auto_size_mode: AutoSizeMode) -> Self
How to do auto-sizing of columns, if at all.
pub const fn max_height(self, max_height: f32) -> Self
Sourcepub const fn stick_to_bottom(self, stick: bool) -> Self
pub const fn stick_to_bottom(self, stick: bool) -> Self
The scroll handle will stick to the bottom position even while the content size changes dynamically.
This can be useful to simulate terminal UIs or log/info scrollers. The scroll handle remains stuck until user manually changes position. Once “unstuck” it will remain focused on whatever content viewport the user left it on.
Sourcepub fn get_id(&self, ui: &Ui) -> Id
pub fn get_id(&self, ui: &Ui) -> Id
Read the globally unique id, based on the current Self::id_salt
and the parent id.
Sourcepub const fn scroll_to_row(self, row: u64, align: Option<Align>) -> Self
pub const fn scroll_to_row(self, row: u64, align: Option<Align>) -> Self
Set a row to scroll to.
align specifies if the row should be positioned in the top, center, or bottom of the view
(using Align::TOP, Align::Center or Align::BOTTOM).
If align is None, the table will scroll just enough to bring the cursor into view.
See also: Self::scroll_to_column.
Sourcepub const fn scroll_to_rows(
self,
rows: RangeInclusive<u64>,
align: Option<Align>,
) -> Self
pub const fn scroll_to_rows( self, rows: RangeInclusive<u64>, align: Option<Align>, ) -> Self
Scroll to a range of rows.
See Self::scroll_to_row for details.
Sourcepub const fn scroll_to_column(self, column: usize, align: Option<Align>) -> Self
pub const fn scroll_to_column(self, column: usize, align: Option<Align>) -> Self
Set a column to scroll to.
align specifies if the column should be positioned in the left, center, or right of the view
(using Align::LEFT, Align::Center or Align::RIGHT).
If align is None, the table will scroll just enough to bring the cursor into view.
See also: Self::scroll_to_row.
Sourcepub const fn scroll_to_columns(
self,
columns: RangeInclusive<usize>,
align: Option<Align>,
) -> Self
pub const fn scroll_to_columns( self, columns: RangeInclusive<usize>, align: Option<Align>, ) -> Self
Scroll to a range of columns.
See Self::scroll_to_column for details.
pub fn show( self, ui: &mut Ui, table_delegate: &mut dyn TableDelegate, ) -> Response
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more