How I can decrease row number on ajax load data

How I can decrease row number on ajax load data

gulasofthackgulasofthack Posts: 3Questions: 1Answers: 0

I have 1000-2000 rows and ~100 columns. The datatables started, and load ~270 row, and this slow. How i can decrease this length parameter when ajax is loading? I not use pagination and use server side, scroller, and saveState. I need only 100 row load each ajax call.

Answers

  • kthorngrenkthorngren Posts: 21,083Questions: 26Answers: 4,908

    Are you saying that you have serverSide enabled but are retrieving more data than what your page length is set for?

    If so then your server script is probably not setup to handle the parameters being sent as described here:
    https://datatables.net/manual/server-side

    Kevin

  • gulasofthackgulasofthack Posts: 3Questions: 1Answers: 0
    edited September 2018

    Dear Kevin!
    This is my server side options:

    var table = $('#example').DataTable( {
                dom: 'Bfrtip',
                "ajax": {
                "url": ajaxId,
                "type": "POST"
                },
                serverSide: true,
                scrollX:true,
                scrollY:650,
                ordering: false,
                searching: true,
                processing:true,
                deferRender:true,
                scrollCollapse: true,
                scroller: true,
                stateSave: true,
                "pageLength":100,
    

    And this is the request when datatables call my ajax:

    The start is "0" its ok, because the length="243".

  • colincolin Posts: 15,236Questions: 1Answers: 2,598
    edited September 2018

    Hi @gulasofthack ,

    It looks like that table initialisation has been cut short. The length should be the number of records per page (or -1 if no paging - but then there's little value to using serverSide if no paging).

    I'd say check that initialisation first of all, and if all good, could you link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • gulasofthackgulasofthack Posts: 3Questions: 1Answers: 0
    edited September 2018

    Dear Colin!

    The scroller not working withot paging

    If I set paging:false,the request length=-1, but the scroller not working, and not call my ajax when visibled row is ended.

    This examplews use scroller for get data from server.
    https://datatables.net/extensions/scroller/examples/initialisation/large_js_source.html
    https://datatables.net/extensions/scroller/examples/initialisation/server-side_processing.html

    And these is working, but I not set max record count from one ajax call.
    The 27310=2730 cells, but 273100=27300 cells, and this draw time is too long.

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Hi @gulasofthack ,

    Yep, as I said, we're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.