From 043778d56b2a7acb923e6a8b28915c36030716aa Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko Date: Sun, 16 Jan 2022 13:39:59 -0500 Subject: [PATCH] Added GetTableFootHeight() and GetTableHeadHeight() --- tableView.go | 4 ++-- tableViewUtils.go | 31 ++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/tableView.go b/tableView.go index 9000617..442e8c9 100644 --- a/tableView.go +++ b/tableView.go @@ -1130,8 +1130,8 @@ func (table *tableViewData) htmlSubviews(self View, buffer *strings.Builder) { buffer.WriteString("") } - headHeight, _ := intProperty(table, HeadHeight, table.Session(), 0) - footHeight, _ := intProperty(table, FootHeight, table.Session(), 0) + headHeight := GetTableHeadHeight(table, "") + footHeight := GetTableFootHeight(table, "") cellBorder := table.getCellBorder() cellPadding := table.boundsProperty(CellPadding) if cellPadding == nil { diff --git a/tableViewUtils.go b/tableViewUtils.go index 090dfc9..01c55fe 100644 --- a/tableViewUtils.go +++ b/tableViewUtils.go @@ -117,14 +117,31 @@ func GetTableVerticalAlign(view View, subviewID string) int { return TopAlign } -// -//HeadHeight = "head-height" +// GetTableHeadHeight returns the number of rows in the table header. +// If the second argument (subviewID) is "" then a value from the first argument (view) is returned. +func GetTableHeadHeight(view View, subviewID string) int { + if subviewID != "" { + view = ViewByID(view, subviewID) + } + if view != nil { + headHeight, _ := intStyledProperty(view, HeadHeight, 0) + return headHeight + } + return 0 +} -//HeadStyle = "head-style" - -//FootHeight = "foot-height" - -//FootStyle = "foot-style" +// GetTableFootHeight returns the number of rows in the table footer. +// If the second argument (subviewID) is "" then a value from the first argument (view) is returned. +func GetTableFootHeight(view View, subviewID string) int { + if subviewID != "" { + view = ViewByID(view, subviewID) + } + if view != nil { + headHeight, _ := intStyledProperty(view, FootHeight, 0) + return headHeight + } + return 0 +} // GetTableCurrent returns the row and column index of the TableView selected cell/row. // If there is no selected cell/row or the selection mode is NoneSelection (0),