feat(table): add SetColumns method to set columns

This commit is contained in:
Maas Lalani
2022-12-01 09:41:08 -05:00
parent 9bcda81051
commit e78f923af6
+6 -1
View File
@@ -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.