pub struct EditTableState<S> {
pub mode: Mode,
pub table: TableState<RowSelection>,
pub editor: S,
pub editor_focus: FocusFlag,
pub mouse: MouseFlags,
}Expand description
State for EditTable.
Contains mode to differentiate between edit/non-edit.
This will lock the focus to the input line while editing.
Fields§
§mode: ModeEditing mode.
table: TableState<RowSelection>Backing table.
editor: SEditor
editor_focus: FocusFlagFocus-flag for the whole editor widget.
mouse: MouseFlagsImplementations§
source§impl<S> EditTableState<S>
impl<S> EditTableState<S>
source§impl<S> EditTableState<S>where
S: EditorState,
impl<S> EditTableState<S>where
S: EditorState,
sourcepub fn is_editing(&self) -> bool
pub fn is_editing(&self) -> bool
Editing is active?
sourcepub fn remove(&mut self, row: usize)
pub fn remove(&mut self, row: usize)
Remove the item at the selected row.
This doesn’t change the actual list of items, but does all the bookkeeping with the table-state.
sourcepub fn edit_new(&mut self, row: usize)
pub fn edit_new(&mut self, row: usize)
Edit a new item inserted at the selected row.
The editor state must be initialized to an appropriate state beforehand.
See EditorState::set_edit_data
This does all the bookkeeping with the table-state and switches the mode to Mode::Insert.
sourcepub fn edit(&mut self, row: usize)
pub fn edit(&mut self, row: usize)
Edit the item at the selected row.
The editor state must be initialized to an appropriate state beforehand.
See EditorState::set_edit_data
This does all the bookkeeping with the table-state and switches the mode to Mode::Edit.
sourcepub fn cancel(&mut self)
pub fn cancel(&mut self)
Cancel editing.
This doesn’t reset the edit-widget.
See EditorState::set_edit_data
But it does all the bookkeeping with the table-state and switches the mode back to Mode::View.
sourcepub fn commit(&mut self)
pub fn commit(&mut self)
Commit the changes in the editor.
This doesn’t copy the data back from the editor to the row-item.
See EditorState::get_edit_data
But it does all the bookkeeping with the table-state and switches the mode back to Mode::View.
Trait Implementations§
source§impl<S: Debug> Debug for EditTableState<S>
impl<S: Debug> Debug for EditTableState<S>
source§impl<S> Default for EditTableState<S>where
S: Default,
impl<S> Default for EditTableState<S>where
S: Default,
source§impl<'a, S> HandleEvent<Event, &'a <S as EditorState>::Context<'a>, EditOutcome> for EditTableState<S>
impl<'a, S> HandleEvent<Event, &'a <S as EditorState>::Context<'a>, EditOutcome> for EditTableState<S>
source§impl<S> HasFocus for EditTableState<S>
impl<S> HasFocus for EditTableState<S>
source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
source§fn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
source§impl<S> HasScreenCursor for EditTableState<S>where
S: HasScreenCursor,
impl<S> HasScreenCursor for EditTableState<S>where
S: HasScreenCursor,
Auto Trait Implementations§
impl<S> !Freeze for EditTableState<S>
impl<S> !RefUnwindSafe for EditTableState<S>
impl<S> !Send for EditTableState<S>
impl<S> !Sync for EditTableState<S>
impl<S> Unpin for EditTableState<S>where
S: Unpin,
impl<S> !UnwindSafe for EditTableState<S>
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> 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