[GH-ISSUE #979] Feature request: generalize list items #714

Open
opened 2026-03-04 01:07:13 +03:00 by kerem · 0 comments
Owner

Originally created by @voodookiidoo on GitHub (Apr 30, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/979

Currently, tview.List is based around text and secondary text.
But if you need to store a list of items and keep their representation valid - you have to keep a list of some items somewhere else, and keep track of their order. What about adding a CustomList (call it how you want), where instead of using plain text for items, use an interface like

type interface ListItem {
GetText() string
GetSecondaryText() string
GetRune() rune
GetSelectionFunction() func()
}

That would make maintaining both data and it's view much easier!
(I implemented it in my fork of your lib, can show you if you'd like to)

Originally created by @voodookiidoo on GitHub (Apr 30, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/979 Currently, tview.List is based around text and secondary text. But if you need to store a list of items and keep their representation valid - you have to keep a list of some items somewhere else, and keep track of their order. What about adding a CustomList (call it how you want), where instead of using plain text for items, use an interface like ``` type interface ListItem { GetText() string GetSecondaryText() string GetRune() rune GetSelectionFunction() func() } ``` That would make maintaining both data and it's view much easier! (I implemented it in my fork of your lib, can show you if you'd like to)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#714
No description provided.