Each TableSheet has a set of selected rows, which is a strict subset of the rows on the sheet.
List of selected rows in sheet order.
Return a list of rows: (a) in batch mode, always return selectedRows (b) in interactive mode, if options.some_selected_rows is True, return selectedRows or all rows if none selected (c) in interactive mode, if options.some_selected_rows is False, return selectedRows or fail if none selected
Changed in version 2.1.
List of selected rows in sheet order. Fail if no rows are selected.
Changed in version 2.1.
Number of selected rows.
- visidata.TableSheet.selectRow(self, row)¶
Add row to set of selected rows. May be called multiple times in one command. Overrideable.
- visidata.TableSheet.unselectRow(self, row)¶
Remove row from set of selected rows. Return True if row was previously selected. Overrideable.
- visidata.TableSheet.isSelected(self, row)¶
Return True if row is selected.
Clear set of selected rows, without calling
unselectRowfor each one.
- visidata.TableSheet.selectByIdx(self, rowIdxs)¶
Add rows indicated by row indexes in rowIdxs to set of selected rows. Async.
- visidata.TableSheet.unselectByIdx(self, rowIdxs)¶
Remove rows indicated by row indexes in rowIdxs from set of selected rows. Async.
- visidata.TableSheet.select(self, rows, status=True, progress=True)¶
Add rows to set of selected rows. Async. Don’t show progress if progress is False; don’t show status if status is False.
- visidata.TableSheet.unselect(self, rows, status=True, progress=True)¶
Remove rows from set of selected rows. Async. Don’t show progress if progress is False; don’t show status if status is False.
Delete all selected rows. Async.
To clear the set of selected rows before any bulk selection, set
options.bulk_select_clear to True.
The status message will include “instead” as a reminder that the option is enabled.
selectedRows feels like a list, but it’s actually a property that iterates over all rows to generate the selected rows in sheet order.
With large datasets, collecting the list of selected rows itself can take a large time, regardless of the number of rows that are actually selected.
So instead of using selectedRows in the execstr, call an
@TableSheet.api function which uses sheet.selectedRows.
Use it as a parameter immediately or save it to a local variable on the first usage, to avoid unnecessary work.
- visidata.TableSheet.orderBy(sheet, *cols, reverse=False)¶
Add cols to internal ordering and re-sort the rows accordingly. Pass reverse as True to order these cols descending. Pass empty cols (or cols of None) to clear internal ordering.
Sort rows according to the current internal ordering.