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

Sorting tables by column #485

Closed
IdlePhysicist opened this issue Aug 15, 2020 · 3 comments · May be fixed by #494
Closed

Sorting tables by column #485

IdlePhysicist opened this issue Aug 15, 2020 · 3 comments · May be fixed by #494

Comments

@IdlePhysicist
Copy link

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
Copy link

There is such a need too.
I use in a workaround, i.e. sorting the original array, clearing the tview and refilling it

@rivo
Copy link
Owner

rivo commented 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
Copy link
Owner

rivo commented 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.

@rivo rivo closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants