Hi, how can I defer the data loading, after the datable drawing?

Hi, how can I defer the data loading, after the datable drawing?

ElChonchonElChonchon Posts: 2Questions: 0Answers: 0
edited January 2012 in General
I use Datatables with an Ajax request, that needs 2-3 seconds to retreive the data. During that time, my HTML page looks really ugly, as Datatables aren't not drawn... or sort of...
I would like, on HTML page loading, to:
1- draw all datatables (3 of them on my HTML page), with headers, toolbars, search, etc... and no rows yet. This should be done very fast, right?
2- then call the AJAX data retreival, meanwhile the 'Processing...' div should be displayed
3- and finally, on AJAX request response, add the data rows in the tables.

I have not been able to find any datatable option to achieve this...
I found iDeferLoading but I'm not sure to understand how it works... and I do not know how many rows my table will contain once data retreival is done.

Replies

  • ElChonchonElChonchon Posts: 2Questions: 0Answers: 0
    Here is one of my DataTables definitions for reference...

    [code]
    oHistoFluxTable = $('#histoflux_table').dataTable( {
    "sDom": '<"H"<"toolbarFlux">fr>t<"F"i>',
    "sScrollX": "100%",
    "sScrollY": "200px",
    "bJQueryUI": true,
    "bPaginate": false,
    "aaSorting": [[0,'asc']],
    "bServerSide": false,
    "bProcessing": true,
    "bAutoWidth": false,
    "bDeferRender": true,
    "sAjaxSource": "getData.asp"
    } );
    [/code]
  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    iDeferLoading example is here: http://datatables.net/release-datatables/examples/server_side/defer_loading.html - but I don't think that will help you too much as you will need to create the HTML rows initially (you can do that if you want - entirely up to you).

    DataTables should be doing the 1, 2, 3 steps you have above - can you link to your page so I can see what is going on please?

    Thanks,
    Allan
This discussion has been closed.