160,000 row cause error

160,000 row cause error

spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

Hi,

I need help. As I have populate very large data which is 160, 000 row. When attempt and the loading took several second and cause error "This page is having a problem". But other datatable is fine.

I've read https://datatables.net/examples/server_side/

I've tried add

processing: true,
serverSide: true

but non it will work.

Please help

Thank

Answers

  • allanallan Posts: 63,274Questions: 1Answers: 10,424 Site admin

    Did you write a script on the server that supports what is needed for server-side processing? You could also use our server-side processing libraries.

    Allan

  • spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

    Hi Alan,

    Thank you for link. I tried use it. it seem return with error if I change GET to POST.

    Is there is solution to use GET instead of POST?

  • allanallan Posts: 63,274Questions: 1Answers: 10,424 Site admin

    You can use GET if your server-side processing scripts are looking for GET rather than POST parameters. This example uses GET (different server-side processing script, but you haven't said what script you are using, posted any code, nor an example, so I'm kind of guessing here!).

    Allan

  • spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

    My apology for not reply you asked.

    I'm using ajax for javascript. See the code.
    $("#tablename").DataTable({
    paging: true,
    info: true,
    lengthChange: true,
    stateSave: true,
    stateDuration: -1,

    ajax: {
    url: getDataInfo,
    type: "GET",
    dataSrc: "",
    headers: {
    Authorization: bearerToken,
    },
    },

    processing: true,
    serverSide: true,

    The rest I've done columnDefs, layout etc.

  • kthorngrenkthorngren Posts: 21,190Questions: 26Answers: 4,925
    edited August 27

    Allan is asking about your server side script. Are you using a server script provided by Datatables/Editor os your own script?

    Server side processing is a client/server solution requiring the server script to perform paging, sorting and searching. It is expected that the server script will only return the rows, 10 for example, for the page being displayed.

    When setting serverSide to true the server script is expected to support this protocol.

    Please provide more information about your server script.

    Kevin

  • spiderkznspiderkzn Posts: 44Questions: 12Answers: 0

    Hi Kevin,

    Apology for not answer. As I'm not sure how to answer but what I've do is in ajax that call to HTTPGets where it will connect to SQL to use Stored procedure where it will run and receive the record. so the record will default getting 160,000 row which it cause the error.

  • kthorngrenkthorngren Posts: 21,190Questions: 26Answers: 4,925

    Ok, so it sounds like you aren't using any of the server side processing scripts provided by Datatables. There are two choices to use Datatables server side processing:

    1. You will need to update your server script to support the Server Side Processing protocol. At a minimum you will need to incorporate the use of LIMIT and OFFSET to handle the paging capabilities. You can look at this PHP script to see a bare bones SSP script.
    2. Use one of the Datatables supplied scripts. See this blog for information about using one of the provided libraries.

    Kevin

Sign In or Register to comment.