pub struct Model {
pub key_map: KeyMap,
pub help: Model,
/* private fields */
}Expand description
Model defines a state for the table widget.
Fields§
§key_map: KeyMapThe key bindings for the table.
help: ModelThe help view for the table.
Implementations§
Source§impl Model
impl Model
Sourcepub fn set_styles(&mut self, s: Styles)
pub fn set_styles(&mut self, s: Styles)
SetStyles sets the table styles.
Sourcepub fn focus(&mut self)
pub fn focus(&mut self)
Focus focuses the table, allowing the user to move around the rows and interact.
Sourcepub fn help_view(&self) -> String
pub fn help_view(&self) -> String
HelpView is a helper method for rendering the help menu from the keymap. Note that this view is not rendered by default and you must call it manually in your application, where applicable.
Sourcepub fn update_viewport(&mut self)
pub fn update_viewport(&mut self)
UpdateViewport updates the list content based on the previously defined columns and rows.
Sourcepub fn selected_row(&self) -> Option<Row>
pub fn selected_row(&self) -> Option<Row>
SelectedRow returns the selected row.
Sourcepub fn set_columns(&mut self, c: &[Column])
pub fn set_columns(&mut self, c: &[Column])
SetColumns sets a new columns state.
Sourcepub fn set_height(&mut self, h: usize)
pub fn set_height(&mut self, h: usize)
SetHeight sets the height of the viewport of the table.
Sourcepub fn set_cursor(&mut self, n: usize)
pub fn set_cursor(&mut self, n: usize)
SetCursor sets the cursor position in the table.
Sourcepub fn move_up(&mut self, n: usize)
pub fn move_up(&mut self, n: usize)
MoveUp moves the selection up by any number of rows. It can not go above the first row.
Sourcepub fn move_down(&mut self, n: usize)
pub fn move_down(&mut self, n: usize)
MoveDown moves the selection down by any number of rows. It can not go below the last row.
Sourcepub fn goto_bottom(&mut self)
pub fn goto_bottom(&mut self)
GotoBottom moves the selection to the last row.
Sourcepub fn from_values(&mut self, value: &str, separator: &str)
pub fn from_values(&mut self, value: &str, separator: &str)
FromValues create the table rows from a simple string. It uses \n
by default for getting all the rows and the given separator for the
fields on each row.