From 48eb859f2161b897813206abdb0aea6ac97d6507 Mon Sep 17 00:00:00 2001 From: bashbunni Date: Wed, 25 Sep 2024 12:40:44 -0700 Subject: [PATCH] feat(table): Bring back Height and Rows --- table/table.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/table/table.go b/table/table.go index 1330a35..0ae4f57 100644 --- a/table/table.go +++ b/table/table.go @@ -421,6 +421,12 @@ func (m *Model) SetRows(r []Row) { m.table.Rows(rows...) } +// Rows returns the rows set for the table. +// TODO do we need this? We used to have m.rows public... +func (m Model) Rows() [][]string { + return m.rows +} + // rowToString helper to unwrap the Row type. func rowToString(rows []Row) [][]string { var out [][]string @@ -451,6 +457,11 @@ func (m *Model) SetHeight(h int) { m.table.Height(h) } +// Height returns the height of the table, including borders. +func (m Model) Height() int { + return m.height +} + // Cursor returns the index of the selected row. func (m Model) Cursor() int { return m.cursor