defer data load
defer data load
Hi,
I would like to ask one question, how to defer loading of data? the requirement is that firstly the data table is empty and no data in there, after user fill in the searching criteria and click the search button, the result will be returned from server side and populate into the table.
1. Init the empty table
[code]
var oTable=$('#userListTable').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true
});
[/code]
2. Click on search button, populate data
[code]
$('#searchButton').click(function() {
//what code should be put down here to init the ajax reqeust?
oTable.fnDraw();
});
[/code]
thanks in advance
hawk
I would like to ask one question, how to defer loading of data? the requirement is that firstly the data table is empty and no data in there, after user fill in the searching criteria and click the search button, the result will be returned from server side and populate into the table.
1. Init the empty table
[code]
var oTable=$('#userListTable').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true
});
[/code]
2. Click on search button, populate data
[code]
$('#searchButton').click(function() {
//what code should be put down here to init the ajax reqeust?
oTable.fnDraw();
});
[/code]
thanks in advance
hawk
This discussion has been closed.
Replies
That will cause DataTables to read the initial data from the DOM (if there is any), and allow Ajax loading at a later time. Note that this only works with server-side processing though. If you are just wanting to use an Ajax source, then I'd suggest using $.ajax() and the DataTables API function fnAddData to first get your data and then load it into the table.
Allan