mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #632] feature request: collapsable list or list-like tree view #460
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#460
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SamWhited on GitHub (Aug 3, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/632
Several times I have had lists where I wanted to group the items in the list under a collapsible heading. For example, in a contact list I might have "groups" that I put my subscriptions into, the groups could then be collapsed or expanded to make the overall view of the list shorter or longer.
I have done this with a custom list widget in the past that adds a concept of "headers", but it could also be a change to the tree view (since it already supports collapsing at multiple levels) and it could just render itself as if it were a list.
@rivo commented on GitHub (Sep 27, 2021):
That's exactly what
TreeViewis for. You can useSetPrefixes()to make it look more like a list:@SamWhited commented on GitHub (Sep 28, 2021):
TreeView doesn't really work the same way though, as far as I can tell. No primary/secondary text, for example, and no easy way to move to the "next" thing in the tree that I see (eg. no way to get an index and nodes aren't linked horizontally).
@rivo commented on GitHub (Feb 15, 2022):
True, there is no primary/secondary text. Moving up or down will shift the focus to the "next" thing in the tree. But you're right, there is no function (yet?) that gives you an index for the next item. There was some discussion about this is #432.
@rivo commented on GitHub (Dec 17, 2022):
Coming back to this, there is now a function
TreeView.Move()which lets you move the selection up/down. Also, secondary text can be implemented using a combination of prefixes and the "selectable" flag. I've modified. Here's an example, based on the file browser demo in the package:I will close this issue soon, then.