Individual column searching (select inputs) must not involve the first child of the row
Individual column searching (select inputs) must not involve the first child of the row
kronikles
Posts: 1Questions: 1Answers: 0
I have a table with a column check box for multi-selecting. But when I add Individual column searching (select inputs)
for filtering I encountered errors because of the column select its null.
How can I not involve the first child of the footer row.
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) {
if (column.search() === '^' + d + '$') {
select.append('<option value="' + d + '" selected="selected">' + d + '</option>')
} else {
select.append('<option value="' + d + '">' + d + '</option>')
}
});
});
this is the code i added of DataTable for Individual column searching (select inputs)
This discussion has been closed.