Documentation
¶
Index ¶
- type ErrorBadCellType
- type ErrorBadType
- type ErrorRowLen
- type Ordered
- type SortingOrderKey
- type StyleKey
- type Table
- func (r *Table) AddRows(rows [][]any) (*Table, error)
- func (r *Table) ClearRows() *Table
- func (r *Table) CursorDown() *Table
- func (r *Table) CursorLeft() *Table
- func (r *Table) CursorRight() *Table
- func (r *Table) CursorUp() *Table
- func (r *Table) GetCursorLocation() (int, int)
- func (r *Table) GetCursorValue() string
- func (r *Table) GetFilter() (columnIndex int, s string)
- func (r *Table) GetOrder() (int, SortingOrderKey)
- func (r *Table) GetVisibleColumnRange() (int, int)
- func (r *Table) MustAddRows(rows [][]any) *Table
- func (r *Table) OrderByAsc(index int) *Table
- func (r *Table) OrderByDesc(index int) *Table
- func (r *Table) Render() string
- func (r *Table) SetFilter(columnIndex int, s string) *Table
- func (r *Table) SetHeight(value int) *Table
- func (r *Table) SetMinWidth(values []int) *Table
- func (r *Table) SetRatio(values []int) *Table
- func (r *Table) SetStylePassing(value bool) *Table
- func (r *Table) SetStyles(styles map[StyleKey]lipgloss.Style) *Table
- func (r *Table) SetTypes(columnTypes ...any) (*Table, error)
- func (r *Table) SetWidth(value int) *Table
- func (r *Table) UnsetFilter() *Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorBadCellType ¶ added in v1.5.0
type ErrorBadCellType struct {
// contains filtered or unexported fields
}
ErrorBadCellType type of cell does not match type of column
func (ErrorBadCellType) Error ¶ added in v1.5.0
func (e ErrorBadCellType) Error() string
type ErrorBadType ¶ added in v1.5.0
type ErrorBadType struct {
// contains filtered or unexported fields
}
ErrorBadType type does not match Ordered interface types
func (ErrorBadType) Error ¶ added in v1.5.0
func (e ErrorBadType) Error() string
type ErrorRowLen ¶ added in v1.5.0
type ErrorRowLen struct {
// contains filtered or unexported fields
}
ErrorRowLen row length is not matching headers len
func (ErrorRowLen) Error ¶ added in v1.5.0
func (e ErrorRowLen) Error() string
type SortingOrderKey ¶ added in v1.5.0
type SortingOrderKey int
const ( SortingOrderAscending SortingOrderKey = iota SortingOrderDescending )
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table responsive, x/y scrollable table that uses magic of FlexBox
func (*Table) AddRows ¶
AddRows add multiple rows, will return error on the first instance of a row that does not match the type set on table will update rows only when there are no errors
func (*Table) ClearRows ¶ added in v1.4.1
ClearRows removes all previously added rows, can be used as part of an update loop
func (*Table) CursorRight ¶
CursorRight move table cursor right
func (*Table) GetCursorLocation ¶
GetCursorLocation returns the current x,y position of the cursor
func (*Table) GetCursorValue ¶
GetCursorValue returns the string of the cell under the cursor
func (*Table) GetFilter ¶
GetFilter returns string used for filtering and the column index TODO: enable multi column filtering
func (*Table) GetOrder ¶ added in v1.4.1
func (r *Table) GetOrder() (int, SortingOrderKey)
GetOrder returns the current order column index and phase
func (*Table) GetVisibleColumnRange ¶ added in v1.5.0
GetVisibleColumnRange returns the left and right visible column indexes
func (*Table) MustAddRows ¶
MustAddRows executes AddRows and panics if there is an error
func (*Table) OrderByAsc ¶ added in v1.4.1
OrderByAsc orders rows by a column with index n, in ascending order
func (*Table) OrderByDesc ¶ added in v1.4.1
OrderByDesc orders rows by a column with index n, in descending order
func (*Table) SetMinWidth ¶
SetMinWidth replaces the minimum width slice, it has to be exactly the len of the headers/rows slices if it's not matching len it will trigger fatal error
func (*Table) SetRatio ¶
SetRatio replaces the ratio slice, it has to be exactly the len of the headers/rows slices also each value have to be greater than 0, if either fails we panic
func (*Table) SetStylePassing ¶
SetStylePassing sets the style passing flag, if true, styles are passed all the way down from box to cell
func (*Table) SetStyles ¶
SetStyles allows overrides of styling elements of the table When only a partial set of overrides are provided, the default styling will be used
func (*Table) SetTypes ¶
SetTypes sets the column type, setting this will remove all the rows so make sure you do it when instantiating Table object or add new rows after this, types have to be one of Ordered interface types