datatable

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 6 Imported by: 0

README

DataTable

Data table for structured information.

Import

"github.com/tinywasm/components/datatable"

Usage

import "github.com/tinywasm/components/datatable"

t := &datatable.DataTable{
    Headers: []string{"ID", "Name", "Role"},
    Rows: [][]string{
        {"1", "Alice", "Admin"},
        {"2", "Bob", "User"},
    },
}

Properties

  • Headers ([]string): Column headers.
  • Rows ([][]string): Data rows.

Back to Catalog

Documentation

Index

Constants

View Source
const (
	PartHeader = widget.Part("header")
	PartRow    = widget.Part("row")
)
View Source
const NameDataTable = widget.Name("datatable")

NameDataTable is the widget name.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataTable

type DataTable struct {
	Element            // value embed — NEVER pointer (TinyGo heap constraint)
	Headers []string   // column titles, fixed at construction
	Rows    [][]string // initial rows, rendered on first paint; empty is fine
	// contains filtered or unexported fields
}

DataTable renders a table whose body rows can be provided up front (Rows) and/or updated later via SetRows (e.g. after an async fetch resolves). Header columns are static — only the body is reactive.

func (*DataTable) Init added in v0.1.7

func (t *DataTable) Init(_ Ctx)

func (*DataTable) Render

func (t *DataTable) Render() *Element

func (*DataTable) RenderCSS

func (t *DataTable) RenderCSS() *css.Stylesheet

RenderCSS defines the datatable visual contract using the style DSL.

func (*DataTable) SetRows added in v0.1.7

func (t *DataTable) SetRows(rows [][]string)

SetRows replaces the table body — safe to call after Init/Render, e.g. once data from an async source (fetch, MCP call) arrives.

func (*DataTable) WidgetKind added in v0.1.13

func (t *DataTable) WidgetKind() widget.Kind

func (*DataTable) WidgetName added in v0.1.13

func (t *DataTable) WidgetName() widget.Name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL