DT doesn't filter
DT doesn't filter
Hello. I am newbie with datatable and I have a problem with setting up. What I need is to implement filtering by keyword but when I type something nothing happen, though sorting works. Below my settings
DT settings
[code]
$(document).ready(function() {
oTable = $(".li_datatable").dataTable({
"sPaginationType": "full_numbers",
"bLengthChange": false,
"aaSorting": [[1]],
"bFilter": false,
"bAutoWidth": false,
"iDisplayLength": 10,
"aoColumnDefs" : [{"bSortable":false,"aTargets":[]}],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "index.php?S=225bc46fff3ace69f1a87caa5195d6b3eecac377&D=cp&C=addons_modules&M=show_module_cp&module=linkedin_search&method=index",
"fnServerData": function (sSource, aoData, fnCallback) {
var extraData = $("#filterform").serializeArray();
for (var i = 0; i < extraData.length; i++) {
if (extraData[i].name == "perpage") {
$(".li_datatable").dataTable().fnSettings()._iDisplayLength = parseInt(extraData[i].value);
}
aoData.push(extraData[i]);
}
$.getJSON(sSource, aoData, fnCallback);
},
"oLanguage": {
"sZeroRecords": "no_entries_matching_that_criteria",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sProcessing": "Processing...",
"oPaginate": {
"sFirst": "",
"sPrevious": "",
"sNext": "",
"sLast": ""
}
},
"fnRowCallback": function(nRow,aData,iDisplayIndex) {
$(nRow).addClass("collapse");
return nRow;
}
});
oSettings = oTable.fnSettings();
oSettings.oClasses.sSortAsc = "headerSortUp";
oSettings.oClasses.sSortDesc = "headerSortDown";
});
// ]]>
[/code]
Here is my form
[code]
Location
idNameuniversalNamewebsiteUrl
[/code]
What need to add so that filtering begin to work . Thanks
DT settings
[code]
$(document).ready(function() {
oTable = $(".li_datatable").dataTable({
"sPaginationType": "full_numbers",
"bLengthChange": false,
"aaSorting": [[1]],
"bFilter": false,
"bAutoWidth": false,
"iDisplayLength": 10,
"aoColumnDefs" : [{"bSortable":false,"aTargets":[]}],
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "index.php?S=225bc46fff3ace69f1a87caa5195d6b3eecac377&D=cp&C=addons_modules&M=show_module_cp&module=linkedin_search&method=index",
"fnServerData": function (sSource, aoData, fnCallback) {
var extraData = $("#filterform").serializeArray();
for (var i = 0; i < extraData.length; i++) {
if (extraData[i].name == "perpage") {
$(".li_datatable").dataTable().fnSettings()._iDisplayLength = parseInt(extraData[i].value);
}
aoData.push(extraData[i]);
}
$.getJSON(sSource, aoData, fnCallback);
},
"oLanguage": {
"sZeroRecords": "no_entries_matching_that_criteria",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sProcessing": "Processing...",
"oPaginate": {
"sFirst": "",
"sPrevious": "",
"sNext": "",
"sLast": ""
}
},
"fnRowCallback": function(nRow,aData,iDisplayIndex) {
$(nRow).addClass("collapse");
return nRow;
}
});
oSettings = oTable.fnSettings();
oSettings.oClasses.sSortAsc = "headerSortUp";
oSettings.oClasses.sSortDesc = "headerSortDown";
});
// ]]>
[/code]
Here is my form
[code]
Location
idNameuniversalNamewebsiteUrl
[/code]
What need to add so that filtering begin to work . Thanks
This discussion has been closed.
Replies
So filtering is done entirely on the server-side. DataTables will send parameters to the server that will tell the server what the applied filter is, and it must then filter the data set as required and return the data to the client: http://datatables.net/usage/server-side
Allan