anchor point for a serverside created table

anchor point for a serverside created table

haraldharald Posts: 16Questions: 7Answers: 1

I am creating the table serverside and send it to the frontend. The table has for better visualisation 200 rows, which means I have a scrollbar on the side. If the user is clicking on a field, the whole table has to be updated serverside and the whole table is sent back to the frontend.

Is there a way to position the table data starting from the clicked field? So that the user can scroll up and down from this row? I understand anchor points and read about column().render(), but how does positioning work, if you send the updated table from the server? is there a plugin available or an example?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,970Questions: 1Answers: 10,160 Site admin

    Are you looking to "paint" only the rows immediately around the scrolling window? If so the Scroller extension for DataTables does that. See this blog post for details on how Scroller works.

    Allan

  • haraldharald Posts: 16Questions: 7Answers: 1

    That's what I am looking for. I guess in the frontend I use mrow().scrollTo(). But how do I insert the row positioning number into the scroller object in the example below?

    new DataTable('#myTable', {
    data: myTableData,
    scrollY: 300,
    scroller: {
    ????????
    }
    });

  • haraldharald Posts: 16Questions: 7Answers: 1
    Answer ✓

    Disregard prior post. I think this is the way...

    new DataTable('#example', {
    ajax: '../data/2500.txt',
    initComplete: function () {
    this.api()
    .row(1000)
    .scrollTo();
    },
    scrollCollapse: true,
    scroller: true,
    scrollY: 200
    });

Sign In or Register to comment.