Only fire ajax request after initialisation

Only fire ajax request after initialisation

briangalbriangal Posts: 5Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
Hey,
My use case is as follows:

I want to initially define my column headers and row data using JSON sent from the server.

I then want to use server-side processing for all my post Initialisation processing.

Here's what I have so far

[code]

$(document).ready(function() {
$.ajax( {
"dataType": 'text',
"type": "GET",
"url": "${request.contextPath}/report/getData",
"success": function (dataStr) {
var data = eval( '('+dataStr+')' );
$('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"aaData": data.aaData,
"aoColumns": data.aoColumns,
"sAjaxSource": "${request.contextPath}/report/getSubsetData"
});
}
} );
});

[/code]

The problem is, it is firing both ajax requests on initialisation.
Is there a way to exclude firing "sAjaxSource" request on initialisation, maybe using "fnServerData"?

Replies

  • allanallan Posts: 61,611Questions: 1Answers: 10,089 Site admin
    http://datatables.net/ref#iDeferLoading :-)

    Allan
  • briangalbriangal Posts: 5Questions: 0Answers: 0
    excellent, thanks
This discussion has been closed.