Moved footer to header .And Sorting taking place when trying to filter the dropdown
Dear All,
In my
fiddle I had moved my footer to header , But sorting is taking place when I try to filter the column.
For that I had created another
thead and trying to point the sort to newly created thead by following the
url which is exactly matching my requirement
I tried adjusting the the below code. But find no luck can any one please do let me know what's the issue
- $('#example').DataTable( {
- initComplete: function () {
- this.api('thead tr:eq(1) th').columns().every( function () {
- var column = this;
- $(column.header()).append("<br>")
- var select = $('<select><option value=""></option></select>')
- .appendTo($(column.header()))
- .on( 'change', function () {
- var val = $.fn.dataTable.util.escapeRegex(
- $(this).val()
- );
- var table = $('#example').DataTable({orderCellsTop: true
- });
- column
- .search( val ? '^'+val+'$' : '', true, false )
- .draw();
- } );
- column.data().unique().sort().each( function ( d, j ) {
- select.append( '<option value="'+d+'">'+d+'</option>' )
- } );
- } );
- }
- } );
Srk