Loading data in blocks

Loading data in blocks

LesGLesG Posts: 14Questions: 0Answers: 0
edited July 2012 in General
I'm loading data into datatables in blocks as I'm forced to use IE8. It loads quick enough. I'm adding 25 records per block, iterating 40 times and displaying the first 25.

How do I utilize iTotalRecords and iTotalDisplayRecords in this scenario?
Is using fnDraw() the best way to load data?

I get a javascript error when the first block starts to load. The console just points to the line 1 of the script, useless IE error. I've tracked it down to _fnGetCellData(). Any ideas?


[code]
var oTable = jQuery('#siteDetail').dataTable( {
"bProcessing": false,
"bServerSide": false,
"sAjaxSource": 'View/Data/DetailDataSite.cfc?method=getdetaildata_json',
"bAutoWidth": false,
"bFilter": false,
"bInfo": true,
"bJQueryUI": false,
"bPaginate": true,
"bFilter": true,
"sPaginationType": "four_button",
"bSort": false,
"iDisplayLength": 25,
"aLengthMenu": [[25, 50, 75, 100], [25, 50, 75, 100]],
"bDeferRender": true,
"sDom": '<"top"lfip<"clear">>rt<"bottom"ip<"clear">>',

fnServerData: function ( sSource, aoData, fnDraw ) {

for (i=1; i<=40; i++){
prevPage = i-1;
if(i > 1){
params = params.replace('PAGENUM=' + prevPage, 'PAGENUM=' + i);
}
jQuery.ajax({
error: function(XMLHttpRequest, textStatus, errorThrown){alert(errorThrown)},
"dataType": "json",
"type": "POST",
"url": sSource,
"data": params,
"success": function(resp){
fnDraw(resp);
}
});
}
}
} );
[/code]

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    The documentation for these parameters is here: http://datatables.net/usage/server-side - however(!) you have:

    > "bServerSide": false

    And as such you will not get those parameters, since they are used only for server-side processing. If you enable server-side processing, then sorting, filtering etc must be done somewhere outside of DataTables (usually at the server).

    Given that you only have 1000 rows, isn't Ajax loading with deferred rendering good enough?

    Allan
  • LesGLesG Posts: 14Questions: 0Answers: 0
    So those two parameters don't mean anything in my scenario?

    It's still a bit slow in IE8. I thought the parameters may be causing the javascript error, maybe not.

    Thanks
    Les
This discussion has been closed.