mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #485] Sorting tables by column #354
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#354
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 @IdlePhysicist on GitHub (Aug 15, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/485
Hi,
I would like to be able to sort tables by selecting a column. At present I do not see a way to do this in tview, but please correct me if there is!
If it is not possible please consider this a feature request.
@LazarenkoA commented on GitHub (Aug 18, 2020):
There is such a need too.
I use in a workaround, i.e. sorting the original array, clearing the tview and refilling it
@rivo commented on GitHub (Sep 15, 2020):
At the moment, yes, you'd have to clear the table and refill it. I was thinking about adding an index map which would map the screen position of the table cell to the position in the original table data. Then you could sort the index map yourself. But I'm afraid this would pose a few problems. For example, how about fixed rows/columns (@tslocum, how did you solve that?). And when you access a cell, would you want to have the original position or the sorted position?
I'm more inclined to implement something like #248 where you have complete control over the data.
@rivo commented on GitHub (Nov 9, 2021):
Virtual tables are now part of the package. This should allow you to implement sorting on your end. So I'm closing this issue for now.