Skip to main content

Table

Struct Table 

Source
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 Table size 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

Source

pub fn new() -> Self

Create a new table, with no columns and no headers, and zero rows.

Source

pub fn id_salt(self, id_salt: impl AsIdSalt) -> Self

Salt added to the parent Ui::id to produce an Id that is unique within the parent Ui.

You need to set this to something unique if you have multiple tables in the same ui.

Source

pub const fn max_rows(self, max_rows: u64) -> Self

Source

pub const fn num_rows(self, num_rows: u64) -> Self

Total number of rows (sticky + non-sticky).

Source

pub fn columns(self, columns: impl Into<Vec<Column>>) -> Self

The columns of the table.

Source

pub const fn num_sticky_cols(self, num_sticky_cols: usize) -> Self

How many columns are sticky (non-scrolling)?

Default is 0.

Source

pub fn headers(self, headers: impl Into<Vec<HeaderRow>>) -> Self

The count and parameters of the sticky (non-scrolling) header rows.

Source

pub const fn auto_size_mode(self, auto_size_mode: AutoSizeMode) -> Self

How to do auto-sizing of columns, if at all.

Source

pub const fn max_height(self, max_height: f32) -> Self

Source

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.

Source

pub fn get_id(&self, ui: &Ui) -> Id

Read the globally unique id, based on the current Self::id_salt and the parent id.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn show( self, ui: &mut Ui, table_delegate: &mut dyn TableDelegate, ) -> Response

Trait Implementations§

Source§

impl Default for Table

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.