Need help on ColumnFilter (Server-side ajax search, wait till finish entering)
Need help on ColumnFilter (Server-side ajax search, wait till finish entering)
I run into problem can't figure out how to apply Server-side ajax search, wait till finish entering or some other way instead of hit server every key. Please help. Thanks
Below are my code:
$(document).ready(function () {
oTable = $('#' + tableId).dataTable({
"bJQueryUI": true,
'bPaginate': true,
'iDisplayLength': 10,
'bProcessing': true,
'bFilter': true,
'bServerSide': true,
"aoColumns": [{ "sWidth": "100px", "bSortable": false }, { "sWidth": "200px", "bSortable": false }, { "sWidth": "100px", "bSortable": false }, { "sWidth": "250px", "bSortable": false}],
'sAjaxSource': ws_GetData,
"fnServerData": function (sSource, aoData, fnCallback) {
GrabData(sSource, aoData, fnCallback)
}
}).fnFilterOnReturn().columnFilter({ //sPlaceHolder: "head:after",
aoColumns: [{ type: "text" }, { type: "text" },
{ type: "text" }, { type: "date-range"}]
});
});
function GrabData(sSource, aoData, fnCallback) {
$.ajax({
type: "GET",
url: sSource,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: aoData,
success: function (result) {
var myObject = JSON.parse(result.d);
fnCallback(myObject);
},
error: function (errMsg) {
alert(errMsg);
}
});
}
Name1
Name2
ID
Reported
Name1
Name2
ID
Reported
Below are my code:
$(document).ready(function () {
oTable = $('#' + tableId).dataTable({
"bJQueryUI": true,
'bPaginate': true,
'iDisplayLength': 10,
'bProcessing': true,
'bFilter': true,
'bServerSide': true,
"aoColumns": [{ "sWidth": "100px", "bSortable": false }, { "sWidth": "200px", "bSortable": false }, { "sWidth": "100px", "bSortable": false }, { "sWidth": "250px", "bSortable": false}],
'sAjaxSource': ws_GetData,
"fnServerData": function (sSource, aoData, fnCallback) {
GrabData(sSource, aoData, fnCallback)
}
}).fnFilterOnReturn().columnFilter({ //sPlaceHolder: "head:after",
aoColumns: [{ type: "text" }, { type: "text" },
{ type: "text" }, { type: "date-range"}]
});
});
function GrabData(sSource, aoData, fnCallback) {
$.ajax({
type: "GET",
url: sSource,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: aoData,
success: function (result) {
var myObject = JSON.parse(result.d);
fnCallback(myObject);
},
error: function (errMsg) {
alert(errMsg);
}
});
}
Name1
Name2
ID
Reported
Name1
Name2
ID
Reported
This discussion has been closed.