diff --git a/crates/ui/src/table.rs b/crates/ui/src/table.rs index 72baa533..7dd6fee2 100644 --- a/crates/ui/src/table.rs +++ b/crates/ui/src/table.rs @@ -126,8 +126,8 @@ pub struct Table { pub horizontal_scroll_handle: ScrollHandle, pub horizontal_scrollbar_state: Rc>, - selection_state: SelectionState, selected_row: Option, + selection_state: SelectionState, right_clicked_row: Option, selected_col: Option, @@ -361,6 +361,11 @@ where cx.notify(); } + /// Returns the selected row index. + pub fn selected_row(&self) -> Option { + self.selected_row + } + /// Sets the selected row to the given index. pub fn set_selected_row(&mut self, row_ix: usize, cx: &mut ViewContext) { self.selection_state = SelectionState::Row; @@ -374,6 +379,11 @@ where cx.notify(); } + /// Returns the selected column index. + pub fn selected_col(&self) -> Option { + self.selected_col + } + /// Sets the selected col to the given index. pub fn set_selected_col(&mut self, col_ix: usize, cx: &mut ViewContext) { self.selection_state = SelectionState::Column;