how make easy Select-Filter for Server-side processing ?
how make easy Select-Filter for Server-side processing ?
zhirkov.ivan
Posts: 3Questions: 2Answers: 0
i'am try using this code from API section
and i see the input selects but if i make then i nothing in result of searching searching
https://datatables.net/examples/server_side/simple.html
https://datatables.net/examples/api/multi_filter_select.html
how i can easy add one-two input-select with my data and for i can apply this filter to table?
$(document).ready(function()
{
$('#example').dataTable(
{
"processing": true,
"serverSide": true,
"ajax": "server_processing.php",
"order": [
[0, 'desc']
],
initComplete: function()
{
this.api().columns().every(function()
{
var column = this;
var select = $('<select><option value=""></option></select>').appendTo($(column.footer()).empty()).on('change', function()
{
var val = $.fn.dataTable.util.escapeRegex(
$(this).val());
column.search(val ? '^' + val + '$' : '', true, false).draw();
});
column.data().unique().sort().each(function(d, j)
{
select.append('<option value="' + d + '">' + d + '</option>')
});
});
}
});
});
This discussion has been closed.
Answers
One way could be to use my yadcf plugin for datatables , see server side example it support server side out of the box (datatbles 1.10 +)