Row limit for datatables?

Row limit for datatables?

cursorcursor Posts: 1Questions: 1Answers: 0

I am using datatables to present CDR information from my PBX. The information is stored in a MariaDB database. Datatables works fine as long as I limit the number of rows I want to display. In my tests about 10,000 records will load fine after a few seconds. Any more than that and I get an error:
DataTables warning: table id=contenido_cdr - Ajax error. For more information about this error, please see http://datatables.net/tn/7

I can see a status of "500" in the response from my server whenever I try to load more thank 10K records and it comes almost immediately after the query is executed. With less thank 10K I get the expected "200" status. Is this a limit on datatables? How can I handle more records than that? 10K records is only about two weeks of calls and I need to display at least a whole month for the report to be useful. Is there a setting or parameter I need to change to be able to handle more rows? Thanks.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 12,600Questions: 0Answers: 2,154

    Hi cursor,

    I'm not aware of any limit, it may be the server-side causing the problems.

    One solution though maybe to defer rendering, so data is only requested from the server when it needs to be displayed. This is discussed further in this example.

    Hope that helps,

    Cheers,

    Colin

  • allanallan Posts: 54,680Questions: 1Answers: 8,552 Site admin

    Yes, as Colin says, there is no hard limit anywhere in DataTables itself. What I suspect is happening here is that you are hitting a memory limit in whatever is processing the server-side data access code. Checking the server's error logs would be the way to confirm if this is the case or not (that's always the first place to look when you get a 500 error - its an "internal server error" code).

    I'd say that in this case you really want to use server-side processing. There is an example of it available here. That way you'll be able to handle millions of rows of data by leveraging the capabilities of the database where the data is stored.

    Allan

  • madhavsmadhavs Posts: 3Questions: 0Answers: 0

    Hi, allan
    me also have a same problem, it's load upto 5500 rows only. if i try to bind 6000 or more throwing same error.

  • colincolin Posts: 12,600Questions: 0Answers: 2,154

    Hi @madhavs ,

    Are you seeing server errors? If you could link to the page, we can take a look.

    Cheers,

    Colin

  • madhavsmadhavs Posts: 3Questions: 0Answers: 0

    Hi @colin,
    here is my code: trying to load all data(more than 1 lakh) at once and searching, sorting at client side only, but i able to bind only 5500 rows please, suggest. thanks in advance.

    jQuery331(document).ready(function ($) {

      $('#table-1 tfoot th').each(function () {
        var title = $(this).text();
        $(this).html('<input type="text" placeholder="search ' + title + '" />');
    });
    
    var table = $("#table-1").DataTable({
    
        "ajax": {
            "url": "/ProductManager/GetProducts",
            },
        "columns": [
    
                   { "data": "Name" },
                   { "data": "Sku" },
                   { "data": "MasterSku" },
                   { "data": "Category" },
                   { "data": "Design" },
                   { "data": "PrimaryColor" },
                   { "data": "Availability" },
                   { "data": "ReleaseDate" },
                   { "data": "PrimaryImageName" },
                   { "data": "Id" }
        ]
    
    });
    // Apply the search
    table.columns().every(function () {
        var that = this;
    
        $('input', this.footer()).on('keyup change', function () {
            if (that.search() !== this.value) {
                that
                    .search(this.value)
                    .draw();
            }
        });
    });
    

    });

  • madhavsmadhavs Posts: 3Questions: 0Answers: 0

    this is the error which i getting:

    DataTables warning: table id=table-1 - Ajax error. For more information about this error, please see http://datatables.net/tn/7

  • tangerinetangerine Posts: 3,108Questions: 24Answers: 364

    The link provided in the error message is there for you to follow. It shows diagnostic steps to explain and resolve the problem.

  • colincolin Posts: 12,600Questions: 0Answers: 2,154

    Hi @madhavs ,

    As @tangerine says, use the info in that link, it'll help. Also, your table isn't using serverSide, so performance will be slow/troublesome with that many records. See this FAQ page here for information,

    Cheers,

    Colin

  • AxotlaAxotla Posts: 1Questions: 0Answers: 0

    same error here, ERR_CONNECTION_RESET in browser

  • colincolin Posts: 12,600Questions: 0Answers: 2,154

    @Axotla That error wasn't mentioned in this thread. It wouldn't be generated by DataTables. It would be worth checking your server logs.

    Colin

  • bobthecoder64bobthecoder64 Posts: 2Questions: 0Answers: 1
    Answer ✓

    Using .NET server side, I was able to avoid the 500 error on by web server by changing the MaxJsonLength from the default to something bigger. Originally i was getting an error at about 700 rows of data. Making this change allow me to display/transfer thousands of rows to the browser.Avoiding Javascript Serializer Issues in .NET

Sign In or Register to comment.