Edit me


import "fyne.io/fyne/v2/widget"


type Table

type Table struct {

	Length       func() (int, int)
	CreateCell   func() fyne.CanvasObject
	UpdateCell   func(id TableCellID, template fyne.CanvasObject)
	OnSelected   func(id TableCellID)
	OnUnselected func(id TableCellID)

Table widget is a grid of items that can be scrolled and a cell selected. It’s performance is provided by caching cell templates created with CreateCell and re-using them with UpdateCell. The size of the content rows/columns is returned by the Length callback.

Since: 1.4

func NewTable

func NewTable(length func() (int, int), create func() fyne.CanvasObject, update func(TableCellID, fyne.CanvasObject)) *Table

NewTable returns a new performant table widget defined by the passed functions. The first returns the data size in rows and columns, second parameter is a function that returns cell template objects that can be cached and the third is used to apply data at specified data location to the passed template CanvasObject.

Since: 1.4

func (*Table) CreateRenderer

func (t *Table) CreateRenderer() fyne.WidgetRenderer

CreateRenderer returns a new renderer for the table.

Implements: fyne.Widget

func (*Table) Select

func (t *Table) Select(id TableCellID)

Select will mark the specified cell as selected.

func (*Table) SetColumnWidth

func (t *Table) SetColumnWidth(id int, width float32)

SetColumnWidth supports changing the width of the specified column. Columns normally take the width of the template cell returned from the CreateCell callback. The width parameter uses the same units as a fyne.Size type and refers to the internal content width not including any standard padding or divider size.

Since: 1.4.1

func (*Table) Unselect

func (t *Table) Unselect(id TableCellID)

Unselect will mark the cell provided by id as unselected.