From e78f923af622e07eb95e9fe4f7b5c8e43ef503d9 Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Tue, 27 Sep 2022 13:11:34 -0400 Subject: [PATCH] feat(table): add `SetColumns` method to set columns --- table/table.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/table/table.go b/table/table.go index a3bc639b..60c8a005 100644 --- a/table/table.go +++ b/table/table.go @@ -280,6 +280,12 @@ func (m *Model) SetRows(r []Row) { m.UpdateViewport() } +// SetColumns set a new columns state. +func (m *Model) SetColumns(c []Column) { + m.cols = c + m.UpdateViewport() +} + // SetWidth sets the width of the viewport of the table. func (m *Model) SetWidth(w int) { m.viewport.Width = w @@ -326,7 +332,6 @@ func (m *Model) MoveUp(n int) { m.viewport.YOffset = clamp(m.viewport.YOffset+n, 1, m.viewport.Height) } m.UpdateViewport() - } // MoveDown moves the selection down by any number of row.