DataTables loading is too slow for json data with DT1.9.2

DataTables loading is too slow for json data with DT1.9.2

narendernarender Posts: 3Questions: 0Answers: 0
edited August 2012 in DataTables 1.9
Hi Allan, i am using datatables for the python server side where i get the json data to UI and i use the JS for adding the json data to the data tables. this has 5 columns and about 2000 rows, DataTables loading is very slow, how can i decrease the load time i tried using bsortclasess:false and bjqueryUI false. Note here i am adding the rows to the datatable dynamically.

Replies

  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    > Note here i am adding the rows to the datatable dynamically.

    With fnAddData? Are you passing the second parameter as false to stop it redrawing every single time?

    Please see http://datatables.net/forums/discussion/9719/how-to-ask-for-help and post a link or at least a debug trace of the table so we can offer some help rather than just guessing :-)

    Allan
  • narendernarender Posts: 3Questions: 0Answers: 0
    edited August 2012
    Hi Allan,
    sorry for not copying the basic details earlier.
    here is the datatable i had used...

    oTable = $('#srchresTable').dataTable( {
    //"bLengthChange": false,
    "bFilter": true,
    "bInfo": true,
    "bPaginate":false,
    //"sScrollX": "100%",
    //"sScrollXInner": "110%",
    //"bScrollCollapse": true,
    // "iDisplayLength": 25,
    // "bProcessing": true,
    "bSortClasses": false,
    "aoColumnDefs": [
    { "bVisible": false, "aTargets": [ 6 ] }
    ],
    "oLanguage": {
    "sEmptyTable": "No logs added to table yet."
    },
    "aaSorting": [[ 1, "asc" ]]
    });


    and i am using following line for adding the row to the datatable dynamically. here the respMesgs is an JSON data having around 2000+ dictionaries. which i am trying to display using datatable.

    var rowData=oTable.fnAddData([
    dispMsgImg,dispDate,
    ((respMesgs[message]['msgBodyFormat']=="edifact")?" Edi: ":"")+respMesgs[message]['msgType'],
    msgSize.toFixed(3),
    beSrchImg+respMesgs[message]['convID'],
    ((respMesgs[message]['origConvID'].length>2)?beSrchImg:"")+respMesgs[message]['origConvID'],
    dispMsg,respMesgs[message]['msgTmStmp']
    ]);

    var oSettings = oTable.fnSettings();
    var nTr= oSettings.aoData[rowData[0]].nTr;
    nTr.className=msgClass;
  • narendernarender Posts: 3Questions: 0Answers: 0
    edited August 2012
    Above are the lines which i use for dynamically populating the dataTable. tried using bPaginate true and false. Once i get the JSON data from the server dataTable parsing & loading itself it takes nearly 3 mts . please correct me in my code if i am using any wrong format.
    allan your help is need here
    Note:I am New to datatables and python
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    1. Make sure you aren't initialising the table in a display:none element

    2. If you enable scrolling again, then make sure you also use Scroller and deferred rendering:
    http://datatables.net/release-datatables/extras/Scroller/index.html

    3. If you enable pagination, make sure you enable deferred rendering

    See also http://datatables.net/faqs#speed

    Allan
This discussion has been closed.