Scroll to row in new api

Scroll to row in new api

sumit25sumit25 Posts: 2Questions: 1Answers: 0

I have a 1.10.2 datatable configured with vertical scroll and no paging, and I want to be able to scroll to a row that is hidden.
I saw this.

http://datatables.net/forums/discussion/2140/scroll-to-highlighted-row

where the relevant code is

var scroller = oTable.fnSettings().nTable.parentNode; 
$(scroller).scrollTo( 'tr.renamesel', 1);

How can I get this scroller object in the new api?

Answers

  • cthiggocthiggo Posts: 1Questions: 0Answers: 0
    edited September 2014

    I think you're looking for:

    $(oTable.DataTable().table().node()).parent();

    Here's the rest of the function that I am using, to work in the new API:

    var oScrollBody = $(oTable.DataTable().table().node()).parent();

    var iVerticalOffset = oTable.offset().top;

    var iOffset = oRow.offset();

    var iOffsetTop = iOffset.top - iVerticalOffset;

    oScrollBody.animate({
    scrollTop: iOffsetTop
    }, 1000);

This discussion has been closed.