Is cell visible within viewport

Tags: #<Tag:0x00007f34472297c8>

Hello,

In my app I need to supply cell’s data dynamically (from Web API).
Total number of rows to update can be very big.
I want to request (and then set) data only for cells that are visible within viewport.

I have tried two methods:

  • GetCell (returns null if cell is not visible);
  • getFirstVisibleRow(), getLastVisibleRow() from autoRowSize plugin.

Both methods are not accurate. First returns more rows than actually visible, second returns less rows than on screen.

Is there any better way? I guess I can try to use getBoundingClientRect() on cell, but I do not know which HTML elem to use for viewport.

Thank you for any tips,
Igor.

Hi @igort

Here’s a set of methods to defined the scope of cells in the viewport (updated on each table scroll)

If you’d need anything more than that let me know.

getFirstVisibleRow / getLastVisibleRow work.
However, getLastVisibleRow() is not accurate, it returns lesser number, I have to add 3 to get actual number. I guess that magical 3 will break sometime.

Hi @igort

Is the method with adding 3 works well? If not we can discuss some options.

I think that I can close this ticket as there’s no feedback for nearly a month.

However, feel free to contact me at support@handsontable.com or open a new ticket.