reload DataTable with with different ajax POST params & content 1.10.0
reload DataTable with with different ajax POST params & content 1.10.0
Hi, thanks for providing this magic tool for the community.
I am currently using DataTable 1.10 version.
My initiation code is below.
$(document).ready(function() {
var content = {
a : 'all', //show all
f : 'all',
v : 'all'
}
var table = $('#searchResultTable').dataTable( {
processing: true,
serverSide: true,
ajax: {
url: 'getContactTable.php',
type: 'POST',
data: content
},
columns:[
{"data": "id"},
{"data": "name"},
{"data": "tel1"},
{"data": "tel2"},
{"data": "mobile"},
{"data": "stat"},
{"data": "zip"},
{"data": "addr"},
{"data": "type"},
{"data": "fm1"},
{"data": "fm2"},
{"data": "fm3"},
{"data": "fm4"},
{"data": "fm5"},
{"data": "fm6"},
{"data": "note"},
{"data": "plp"}
],
scrollY: 150,
scrollX: true
} );
$('#txfKeyword').bind("enterKey",function(e){
var content = {
a : 'keyword', //show all
f : $("#selField").val(),
v : $("#txfKeyword").val()
}
//MAGIC CODE NEEDED TO BE INSERTED HERE!!!!
//HOW to update table
});
$('#txfKeyword').keyup(function(e){ if(e.keyCode == 13){$(this).trigger("enterKey");} });
});
How can I update the table using this new ajax content parameter into the datatable I initialized above; so that it can refresh?
In other words, I would like to reload the table with new ajax parameter after I hit ENTER in $('#txfKeyword'). This suppose to be straight forward but I just can't figure out how. I wish someone can guide me by showing me specific code
Thanks :)
Replies