Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Actor ¶
type Actor[T any] interface { Load() ([]T, error) // OnKey is called when a key is pressed on a row. // Note: key might be a set of keys, e.g. "ctrl+c", it is important to // consider all possible combinations. // It is never called on "r", "ctrl+c" or "q" key presses, as they're // handled by the table itself. OnKey(key string, row int, val T) (hide bool, err error) }
Actor is a data source for a table.
type Column ¶
Column is a column to show in the table. It also contains a function to extract the value from the data source.
type RefreshingDataTable ¶ added in v0.14.1
type RefreshingDataTable[T any] struct { RefreshingDataTableParams[T] // contains filtered or unexported fields }
RefreshingDataTable is a table, that loads its data from an Actor with periodic updates, or on demand.
func NewRefreshingDataTable ¶ added in v0.14.1
func NewRefreshingDataTable[T any](params RefreshingDataTableParams[T]) (*RefreshingDataTable[T], error)
NewRefreshingDataTable creates a new RefreshingDataTable.
func (*RefreshingDataTable[T]) Focus ¶ added in v0.14.1
func (t *RefreshingDataTable[T]) Focus()
Focus focuses the table.
func (*RefreshingDataTable[T]) Init ¶ added in v0.14.1
func (t *RefreshingDataTable[T]) Init() tea.Cmd
Init does nothing.
func (*RefreshingDataTable[T]) View ¶ added in v0.14.1
func (t *RefreshingDataTable[T]) View() string
View renders the table.
type RefreshingDataTableParams ¶ added in v0.14.1
type RefreshingDataTableParams[T any] struct { Columns []Column[T] Actor Actor[T] PollInterval time.Duration BorrowedHeight int // table will cut off these lines from the top at render }
RefreshingDataTableParams are the parameters to initialize a RefreshingDataTable.
Click to show internal directories.
Click to hide internal directories.