core
core copied to clipboard
Table: Empty headers with empty slice
Describe the bug
It seems table headers are blank when the passed slice has no rows.
Expected: Headers would be set based on the slice type (or have an API for setting them explicitly).
How to reproduce
Initialize an empty slice of the intended type and render a Table.
For ref, the command I ran: core run -auto-update-interval 1s web
Example code
package main
import (
"cogentcore.org/core/core"
)
func main() {
b := core.NewBody()
type item struct {
Name string
IP string
}
tbl := core.NewTable(b)
var items []item // same behavior with items := []item{}
tbl.SetSlice(&items)
b.RunMainWindow()
}
Relevant output
No response
Platform
Web
Thank you for reporting this. I can reproduce this and we will work on fixing this soon.