how to config dynamic footer
how to config dynamic footer
html:
my js is:
var table=$('#sls_app_list').DataTable({
ajax: {
url: './ajax/' + NOW_PAGE + "_ajax.php",
data:function( d ) {
d.oper= "init";
d.year= $("#year").val();
},
error:handleAjaxError
},
"columns": [
{"data": "year_id", "title": "year"},
{"data": "year_name", "title": "name"}
]
});
and i wish use drop box list by column,so i find this code:
footerCallback: 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>')
});
});
}
how can show footer in this datatable?
This question has an accepted answers - jump to answer
Answers
Is there a tfoot tag in your HTML?
haha I forgot it....
my html :
and i try to add
〈table id="sls_app_list" class="display" cellspacing="0" width="100%"〉
〈tfoot〉〈/tfoot〉
〈/table〉
it's havnt show the foot...
DataTables itself will not dynamically add footer cells. You'd need to do it using jQuery (or DOM methods) before you initialise the table.
Allan