Get visible rows in Datatable


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



  • edited August 2018


    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:

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion