Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table: Empty headers with empty slice #1385

Open
mastercactapus opened this issue Dec 21, 2024 · 1 comment
Open

Table: Empty headers with empty slice #1385

mastercactapus opened this issue Dec 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working correctly confirmed This bug has been confirmed
Milestone

Comments

@mastercactapus
Copy link

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

@mastercactapus mastercactapus added the bug Something isn't working correctly label Dec 21, 2024
@github-project-automation github-project-automation bot moved this to Todo in Bugs Dec 21, 2024
@kkoreilly
Copy link
Member

Thank you for reporting this. I can reproduce this and we will work on fixing this soon.

@kkoreilly kkoreilly self-assigned this Dec 21, 2024
@kkoreilly kkoreilly added the confirmed This bug has been confirmed label Dec 21, 2024
@kkoreilly kkoreilly assigned rcoreilly and unassigned kkoreilly Dec 21, 2024
@kkoreilly kkoreilly added this to the v0.4 milestone Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly confirmed This bug has been confirmed
Projects
Status: Todo
Development

No branches or pull requests

3 participants