mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #470] Question. How to handle a mouse click on a table cell #337
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#337
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 @LazarenkoA on GitHub (Jul 15, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/470
The task is to perform some actions when clicking on a cell in the table heading, for example, sorting by the current column, how to implement this?
PS
I tried searching in the documentation, did not find
@LazarenkoA commented on GitHub (Jul 16, 2020):
i found, SetMouseCapture
@LazarenkoA commented on GitHub (Jul 16, 2020):
just don't know how to get a cell by position
@rivo commented on GitHub (Aug 18, 2020):
There is the
Table.SetSelectionChangedFunc()which you can use. The callback will receive the position of the clicked cell.Let me know if this helps.
@LazarenkoA commented on GitHub (Aug 18, 2020):
Thanks, but it will not work for my case, I click on the table header, but it is set for it SetSelectable(false)
@rivo commented on GitHub (Sep 15, 2020):
I understand. Makes sense. I've added
TableCell.SetClickedFunc(). That should help you implement the sorting function in your table.@LazarenkoA commented on GitHub (Sep 17, 2020):
I have 2 questions ☺
go get -u "github.com/gdamore/tcell@master"but I don't see the methodSetClickedFunc().