Documentation ¶
Overview ¶
Package tableview provides a way to display a table widget in a terminal, using all the width and height and being able to scroll vertically or horizontally, search, filter, sort and adding additional funcionality
Index ¶
- Constants
- Variables
- type Application
- type TableView
- func (t *TableView) FillTable(columns []string, data [][]string)
- func (t *TableView) JoinRows(startRow int, endRow int) error
- func (t *TableView) NewCommand(ch rune, text string, action func(row int))
- func (t *TableView) Run()
- func (t *TableView) SetAlign(column int, align int)
- func (t *TableView) SetCell(row int, column int, content string)
- func (t *TableView) SetExpansion(column int, expansion int)
- func (t *TableView) SetSelectedFunc(action func(row int))
- func (t *TableView) Suspend(f func())
Constants ¶
const ( AlignLeft = tview.AlignLeft AlignCenter = tview.AlignCenter AlignRight = tview.AlignRight )
Text alignment in each column.
Variables ¶
var DefaultApplication = NewApplication()
Functions ¶
This section is empty.
Types ¶
type Application ¶ added in v0.1.2
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶ added in v0.1.2
func NewApplication() *Application
func (*Application) NewTable ¶ added in v0.1.2
func (a *Application) NewTable() *TableView
func (*Application) Run ¶ added in v0.1.2
func (a *Application) Run()
func (*Application) SetActiveTable ¶ added in v0.1.2
func (a *Application) SetActiveTable(t *TableView)
type TableView ¶
type TableView struct { ID int // index of this table in parent Application's "tables" // contains filtered or unexported fields }
TableView holds a description of one table to be displayed
func (*TableView) JoinRows ¶ added in v0.1.3
JoinRows marks several rows to be always together, and with the same visibility. This affects the behaviour of t.search(), t.filterData() and t.sort()
func (*TableView) NewCommand ¶
NewCommand sets the function to be executed when a given key is pressed. The selected row is passed to the function as an argument.
func (*TableView) Run ¶
func (t *TableView) Run()
Run draws the table and starts a loop, waiting for keystrokes and redrawing the screen. It exits when ^C or "q" is pressed.
func (*TableView) SetAlign ¶
SetAlign sets the alignment in this column. This must be either AlignLeft, AlignCenter, or AlignRight.
func (*TableView) SetExpansion ¶
SetExpansion sets the value by which the column expands if the available width for the table is more than the table width.
func (*TableView) SetSelectedFunc ¶
SetSelectedFunc sets the function to be executed when the user presses ENTER. The selecred row is passed to the function as an argument.