Bug scroller server side with displayStart option and infinite scroll.

Bug scroller server side with displayStart option and infinite scroll.

perrotinperrotin Posts: 39Questions: 9Answers: 1
edited May 2019 in Bug reports

Hello,

I noticed a bug when using scroller extension on a dataTable with server side processing and with infinite scroll on.

I would like to be able to open the table directly on a given row ( in the middle of the list) but without reloading the dataTable several time. ( that's what appends when you use row().scrollTo() or scroller.page() function from api ).

I thought of using displayStart option to match the row position in list, but result on the page is empty ( json page do return results).

I use DataTables-1.10.18

My configuration is

$('#dataTable').DataTable({
    dom: 'Bfirtp',
    serverSide: true,
    ajax: {
        url: ....,
        type: "POST"
    },
    scrollY: $(window).height  - 200,
    scroller: {
        displayBuffer: 20,
        rowHeight: 50,
        loadingIndicator: true
    },
    deferRender: true,
    responsive: false,
    displayStart: 1000,
    select: false,
    order: [[0,'desc']],
    columns: [
        ...
    ]
}

Thank you for your great job on dataTable

Julian

Replies

  • perrotinperrotin Posts: 39Questions: 9Answers: 1

    I found this related topic and tried to apply the patch.

    https://datatables.net/forums/discussion/comment/143958/#Comment_143958

    It worked for the scroll position, but ajax page was style called twice without purpose.

    adding a timeout on line 953 seams to prevent page reload, I haven't really tested if it breaks other things

    setTimeout( function () {
    that.s.ingnoreScroll = false;
    }, 0 );

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @perrotin ,

    Yep, displayStart doesn't play well with Scroller. This thread here has a potential fix - it's not been integrated yet unfortunately, it's still in the backlog.

    Cheers,

    Colin

  • perrotinperrotin Posts: 39Questions: 9Answers: 1

    Hi Colin,

    thanks for answering.
    I did saw the post as mentioned in my earlier comment.
    If you do correct this on the next Scroller version, please take care of avoiding the unnecessary ajax calls. (see the patch I proposed)

    Thank you
    Julian

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @perrotin ,

    Will do, and thanks for taking the time to post it,

    Cheers,

    Colin

This discussion has been closed.