pub struct Table<D: TableDelegate> {
pub loop_selection: bool,
pub col_selectable: bool,
pub row_selectable: bool,
pub sortable: bool,
pub col_resizable: bool,
pub col_movable: bool,
pub col_fixed: bool,
pub vertical_scroll_handle: UniformListScrollHandle,
pub vertical_scroll_state: ScrollbarState,
pub horizontal_scroll_handle: VirtualListScrollHandle,
pub horizontal_scroll_state: ScrollbarState,
/* private fields */
}
Fields§
§loop_selection: bool
Whether the table can loop selection, default is true.
When the prev/next selection is out of the table bounds, the selection will loop to the other side.
col_selectable: bool
Whether the table can select column.
row_selectable: bool
Whether the table can select row.
sortable: bool
Whether the table can sort.
col_resizable: bool
Whether the table can resize columns.
col_movable: bool
Whether the table can move columns.
col_fixed: bool
Enable/disable fixed columns feature.
vertical_scroll_handle: UniformListScrollHandle
§vertical_scroll_state: ScrollbarState
§horizontal_scroll_handle: VirtualListScrollHandle
§horizontal_scroll_state: ScrollbarState
Implementations§
Source§impl<D> Table<D>where
D: TableDelegate,
impl<D> Table<D>where
D: TableDelegate,
pub fn new(delegate: D, _: &mut Window, cx: &mut Context<'_, Self>) -> Self
pub fn delegate(&self) -> &D
pub fn delegate_mut(&mut self) -> &mut D
Sourcepub fn stripe(self, stripe: bool) -> Self
pub fn stripe(self, stripe: bool) -> Self
Set to use stripe style of the table, default to false.
pub fn set_stripe(&mut self, stripe: bool, cx: &mut Context<'_, Self>)
Sourcepub fn border(self, border: bool) -> Self
pub fn border(self, border: bool) -> Self
Set to use border style of the table, default to true.
Sourcepub fn loop_selection(self, loop_selection: bool) -> Self
pub fn loop_selection(self, loop_selection: bool) -> Self
Set to loop selection, default to true.
Sourcepub fn col_movable(self, col_movable: bool) -> Self
pub fn col_movable(self, col_movable: bool) -> Self
Set to enable/disable column movable, default to true.
Sourcepub fn col_resizable(self, col_resizable: bool) -> Self
pub fn col_resizable(self, col_resizable: bool) -> Self
Set to enable/disable column resizable, default to true.
Sourcepub fn sortable(self, sortable: bool) -> Self
pub fn sortable(self, sortable: bool) -> Self
Set to enable/disable column sortable, default true
Sourcepub fn row_selectable(self, row_selectable: bool) -> Self
pub fn row_selectable(self, row_selectable: bool) -> Self
Set to enable/disable row selectable, default true
Sourcepub fn col_selectable(self, col_selectable: bool) -> Self
pub fn col_selectable(self, col_selectable: bool) -> Self
Set to enable/disable column selectable, default true
Sourcepub fn scrollbar_visible(self, vertical: bool, horizontal: bool) -> Self
pub fn scrollbar_visible(self, vertical: bool, horizontal: bool) -> Self
Set scrollbar visibility.
Sourcepub fn refresh(&mut self, cx: &mut Context<'_, Self>)
pub fn refresh(&mut self, cx: &mut Context<'_, Self>)
When we update columns or rows, we need to refresh the table.
Sourcepub fn scroll_to_row(&mut self, row_ix: usize, cx: &mut Context<'_, Self>)
pub fn scroll_to_row(&mut self, row_ix: usize, cx: &mut Context<'_, Self>)
Scroll to the row at the given index.
pub fn scroll_to_col(&mut self, col_ix: usize, cx: &mut Context<'_, Self>)
Sourcepub fn selected_row(&self) -> Option<usize>
pub fn selected_row(&self) -> Option<usize>
Returns the selected row index.
Sourcepub fn set_selected_row(&mut self, row_ix: usize, cx: &mut Context<'_, Self>)
pub fn set_selected_row(&mut self, row_ix: usize, cx: &mut Context<'_, Self>)
Sets the selected row to the given index.
Sourcepub fn selected_col(&self) -> Option<usize>
pub fn selected_col(&self) -> Option<usize>
Returns the selected column index.
Sourcepub fn set_selected_col(&mut self, col_ix: usize, cx: &mut Context<'_, Self>)
pub fn set_selected_col(&mut self, col_ix: usize, cx: &mut Context<'_, Self>)
Sets the selected col to the given index.
Sourcepub fn clear_selection(&mut self, cx: &mut Context<'_, Self>)
pub fn clear_selection(&mut self, cx: &mut Context<'_, Self>)
Clear the selection of the table.
Sourcepub fn visible_range(&self) -> &VisibleRangeState
pub fn visible_range(&self) -> &VisibleRangeState
Returns the visible range of the rows and columns.
Trait Implementations§
Source§impl<D> Focusable for Table<D>where
D: TableDelegate,
impl<D> Focusable for Table<D>where
D: TableDelegate,
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Source§impl<D> Render for Table<D>where
D: TableDelegate,
impl<D> Render for Table<D>where
D: TableDelegate,
Source§impl<D> Sizable for Table<D>where
D: TableDelegate,
impl<D> Sizable for Table<D>where
D: TableDelegate,
impl<D> EventEmitter<TableEvent> for Table<D>where
D: TableDelegate,
Auto Trait Implementations§
impl<D> Freeze for Table<D>where
D: Freeze,
impl<D> !RefUnwindSafe for Table<D>
impl<D> !Send for Table<D>
impl<D> !Sync for Table<D>
impl<D> Unpin for Table<D>where
D: Unpin,
impl<D> !UnwindSafe for Table<D>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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