Get visible rows in Datatable

Hi,

I want to get all visible rows in a datatable which are shown in the current scrollview (not datapages).
Is this possible to achieve?

Hello!

Yeap, it’s possible. You can get current scroll position with the getScrollState method. In our case, we are interested in the vertical scroll:

var state = table.getScrollState().y;

And via the row height we can get the index of the first visible record:

 var first = Math.floor(state / table.config.rowHeight);

And, finally, using the getVisibleCount we can calculate the index of the last one:

var last = first + table.getVisibleCount();

Please check the sample: Code Snippet