sAjaxsource modified url (search) making 3 times Ajax call to server instead of 1 in datatable
sAjaxsource modified url (search) making 3 times Ajax call to server instead of 1 in datatable
nlnr
Posts: 1Questions: 0Answers: 0
Hi my code is like this,first ajax call is working fine ,if i enter the new value in search box and pressing the enter then it is making two ajax calls first with old search value and then new search value.i want to make only one ajax call with new search value, please help on this.
var oTable =$("#deviceListTable").dataTable({
"bPaginate": true,
"sPaginationType" : "full_numbers",
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"sScrollY": "150px",
"bScrollCollapse": false,
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
//"sSearch" : isearch,
"sAjaxSource": "./ajaxDevicelist.htm?&fromDate="+fromDate+"&toDate="+toDate+"&IsExport=false&mySearch="+isearch,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
{
"sExtends": "text",
"sButtonText": "Export to Excel",
"fnClick": function ( nButton, oConfig, oFlash ) {
window.location.href="./ajaxDevicelist.htm?&fromDate="+fromDate+"&toDate="+toDate+"&IsExport=true";
}
},
{
"sExtends": "text",
"sButtonText": "Download Configs",
"fnClick": function ( nButton, oConfig, oFlash ) {
dialogval.dialog( "open" );
}
}
]
},
"aoColumnDefs":[/*{
"aTargets": [5],
"fnRender": function (o,val) {
return "";
}
},*/
{
"aTargets": [5],
"fnRender": function (o,val) {
return "";
}
},
{ "bSortable": false, "aTargets": [ 5 ] }
]
});
$("div.dataTables_filter input").keyup( function (e) {
if (e.keyCode == 13) {
oTable.fnClearTable(this);
isearch= $('#deviceListTable_filter label input:text').val();
console.log("isearch value is :"+isearch);
var oSettings = oTable.fnSettings();
oSettings.sAjaxSource = "./ajaxDevicelist.htm?&fromDate="+fromDate+"&toDate="+toDate+"&IsExport=false&mySearch="+isearch;
console.log("isearch value is :"+isearch);
oTable.fnDraw();
}
} );
var oTable =$("#deviceListTable").dataTable({
"bPaginate": true,
"sPaginationType" : "full_numbers",
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"sScrollY": "150px",
"bScrollCollapse": false,
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
//"sSearch" : isearch,
"sAjaxSource": "./ajaxDevicelist.htm?&fromDate="+fromDate+"&toDate="+toDate+"&IsExport=false&mySearch="+isearch,
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"aButtons": [
{
"sExtends": "text",
"sButtonText": "Export to Excel",
"fnClick": function ( nButton, oConfig, oFlash ) {
window.location.href="./ajaxDevicelist.htm?&fromDate="+fromDate+"&toDate="+toDate+"&IsExport=true";
}
},
{
"sExtends": "text",
"sButtonText": "Download Configs",
"fnClick": function ( nButton, oConfig, oFlash ) {
dialogval.dialog( "open" );
}
}
]
},
"aoColumnDefs":[/*{
"aTargets": [5],
"fnRender": function (o,val) {
return "";
}
},*/
{
"aTargets": [5],
"fnRender": function (o,val) {
return "";
}
},
{ "bSortable": false, "aTargets": [ 5 ] }
]
});
$("div.dataTables_filter input").keyup( function (e) {
if (e.keyCode == 13) {
oTable.fnClearTable(this);
isearch= $('#deviceListTable_filter label input:text').val();
console.log("isearch value is :"+isearch);
var oSettings = oTable.fnSettings();
oSettings.sAjaxSource = "./ajaxDevicelist.htm?&fromDate="+fromDate+"&toDate="+toDate+"&IsExport=false&mySearch="+isearch;
console.log("isearch value is :"+isearch);
oTable.fnDraw();
}
} );
This discussion has been closed.