[GH-ISSUE #1041] Event for table navigation before/after first/last row? #751

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

Originally created by @jsumners-nr on GitHub (Oct 17, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1041

If we have a table backed by a TableContent that provides just enough rows for the table's visible dimensions, is there a way to detect when an attempt is made to navigate to an off-screen row? It doesn't seem like the SetSelectionChangedFunc receives any events in such a case.

Originally created by @jsumners-nr on GitHub (Oct 17, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1041 If we have a table backed by a `TableContent` that provides just enough rows for the table's visible dimensions, is there a way to detect when an attempt is made to navigate to an off-screen row? It doesn't seem like the `SetSelectionChangedFunc` receives any events in such a case.
Author
Owner

@jsumners-nr commented on GitHub (Oct 17, 2024):

I just discovered https://github.com/rivo/tview/issues/248 and the opening post is describing my exact use case. I am working on a log file explorer that will "index" the logs into an sqlite database. Various features will require getting new rows to display in the view. Doing this in memory is fine for the basic use, but I have seen some very large log files that this tool will be intended to work with (as in 3+ GiB). So at some point I'm going to need to window the data.

For what it's worth, I'm already making use of TableContent to facilitate presenting the data.

<!-- gh-comment-id:2419952786 --> @jsumners-nr commented on GitHub (Oct 17, 2024): I just discovered https://github.com/rivo/tview/issues/248 and the opening post is describing my exact use case. I am working on a log file explorer that will "index" the logs into an sqlite database. Various features will require getting new rows to display in the view. Doing this in memory is fine for the basic use, but I have seen some _very_ large log files that this tool will be intended to work with (as in 3+ GiB). So at some point I'm going to need to window the data. For what it's worth, I'm already making use of `TableContent` to facilitate presenting the data.
Author
Owner

@jsumners-nr commented on GitHub (Feb 2, 2026):

A bit of an update on this: I didn't see https://github.com/rivo/tview/wiki/VirtualTable originally. I came back to my project recently, found that document, and refactored my application to apply it (I was already using TableContent, but in a less optimal way). I have seen a significant performance improvement, but my app still chokes when the data set is too large. My situation:

  1. I have potentially 100s of thousands of log lines to parse and display.
  2. To support searching through those logs, I parse the data in to an sqlite full-text search database.
  3. To support TableContent's design, I issue queries like:
select
	rowid, row_number() over (order by rowid) as row_num, *
from logs_fts
where logs_fts match '%s'

This, I believe, is where the issue lies. In order to support TableContent's (row, col) access, I need the row_number window function. That results in a full table scan for each update of TableContent.

Basically, I'm struggling to understand how to utilize TableContent in an efficient manner.

<!-- gh-comment-id:3835197479 --> @jsumners-nr commented on GitHub (Feb 2, 2026): A bit of an update on this: I didn't see https://github.com/rivo/tview/wiki/VirtualTable originally. I came back to my project recently, found that document, and refactored my application to apply it (I was already using `TableContent`, but in a less optimal way). I have seen a significant performance improvement, but my app still chokes when the data set is too large. My situation: 1. I have potentially 100s of thousands of log lines to parse and display. 2. To support searching through those logs, I parse the data in to an sqlite full-text search database. 3. To support `TableContent`'s design, I issue queries like: ```sql select rowid, row_number() over (order by rowid) as row_num, * from logs_fts where logs_fts match '%s' ``` This, I believe, is where the issue lies. In order to support `TableContent`'s `(row, col)` access, I need the `row_number` window function. That results in a full table scan for each update of `TableContent`. Basically, I'm struggling to understand how to utilize `TableContent` in an efficient manner.
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#751
No description provided.