Datatable not working for morethan 500 rows

Datatable not working for morethan 500 rows

santosh6681santosh6681 Posts: 4Questions: 0Answers: 0
edited December 2012 in DataTables 1.9
hi,
i am using datatable 1.9 and using json web service as data source.it working fine for below 500 rows but not working for more than that.any help would be appreciated.


thanks and regards

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please provide a link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • santosh6681santosh6681 Posts: 4Questions: 0Answers: 0
    hi allan my data is coming from web service so i am unable to host it in jsfiddle .every thing works fine for below 500 rows but not working for more than 500 rows here is my code.





    $(document).ready(function () {
    function renderTable(result) {
    var dtData = [];
    $.each(result, function () {
    dtData.push([
    this.rank,
    this.name,
    this.LW_amount,
    this.LW_units,
    this.CW_amount,
    this.CW_units
    ]);
    });

    $('#grid').dataTable({ //grid is the id of the table
    'aaData': dtData,

    //'fnRowCallback': function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
    //if (aData[2] > 20000) {

    // $('td:eq(0)', nRow).addClass('conditionalRowColor');
    //$('td:eq(1)', nRow).addClass('conditionalRowColor');
    //$('td:eq(2)', nRow).addClass('conditionalRowColor');
    //$('td:eq(3)', nRow).addClass('conditionalRowColor');
    //$('td:eq(4)', nRow).addClass('conditionalRowColor');
    //$('td:eq(5)', nRow).addClass('conditionalRowColor');
    // }
    //return nRow;
    //},

    'bFilter': true,
    'bLengthChange': true,
    "aoColumns": [{ "sClass": "right" }, { "sClass": "left" }, { "sClass": "right" }, { "sClass": "right" }, { "sClass": "right" }, { "sClass": "right"}],
    'sPaginationType': 'full_numbers',
    'iDisplayLength':5,
    "fnDrawCallback": function () {
    if ($("#grid").find("tr:not(.ui-widget-header)").length <= 5) {
    $('div.dataTables_paginate')[0].style.display = "none";
    } else {
    $('div.dataTables_paginate')[0].style.display = "block";
    }
    }
    });
    }


    $.ajax({
    type: "GET",
    url: "http://localhost:1504/WebService1.asmx/Getsales",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
    renderTable(response.d);
    },
    failure: function (errMsg) {
    $('#errorMessage').text(errMsg); //errorMessage is id of the div
    }
    });
    });
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Looks fine to me - I don't know why that would stop working at 500 rows. I'd need to see an example to know why.

    Allan
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    btw - that will be slow as anything!

    I'd very much suggest you have a look at this blog post and use DataTables built in Ajax source options along with deferred rendering to see things up massively: http://datatables.net/blog/Extended_data_source_options_with_DataTables
  • santosh6681santosh6681 Posts: 4Questions: 0Answers: 0
    its working very fine for fewer rows.but not working for more than 500 rows.how can i produce example because i am consuming from webservice
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    When you say not working - what do you actually mean? Slow, Javascript error, crash? This is why a link to a test case is needed so I can see what is actually happening.

    Did you try changing to using the DataTables Ajax with sAjaxSource and mData ?

    Allan
  • santosh6681santosh6681 Posts: 4Questions: 0Answers: 0
    hi allan not working in the sense no values displaying in table
This discussion has been closed.