Select input only showing first page result
Select input only showing first page result
Good Day All.
I've been battling a bit getting the select input boxes working by using the multi_filter_select example shown. The problem is that only the first page results are shown. I use server-side processing and a date range filter. What I aim to do is have individual column filtering as well as there is a lot of data shown. I haven't changed the code much regarding the server side calls, using ssp.class.php, and the date range filter runs inside the php file.
Any input is appreciated.
Thanks
EDIT: the code for completeness,
$(document).ready(function() {
var table = $('#prodWinderTable').DataTable({
"scrollX": "true",
"oTableTools":{"aButtons":[{
"oSelectorOpts":{
page:'current'
}
}]},
"processing": "true",
"serverSide": "true",
"ajax" : {
"url":"script/prodWinder_result.php",
"data": function ( d ){
d.min = $('#min').val();
d.max = $('#max').val();
}
},
initComplete: function () {
this.api().columns().every( function () {
var column = this;
var select = $('<select style="width:100%;"><option value=""></option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( $(this).val() )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
});
$('#min').change(function() { table.draw(); })
$('#max').change(function() { table.draw(); });
$('#clear').click(function() {
$('#form')[0].reset();
table.draw();
});
var tt = new $.fn.dataTable.TableTools( table );
$( tt.fnContainer() ).insertBefore('div.dataTables_wrapper');
var colvis = new $.fn.dataTable.ColVis( table );
$(colvis.button()).insertBefore('div.dataTables_wrapper');
$('.ColVis_Button').removeClass("ColVis_Button ColVis_Master_Button").addClass("btn btn-default");
$('#min').datepicker({dateFormat: "yy-mm-dd"});
$('#max').datepicker({dateFormat: "yy-mm-dd"});
} );
Answers
OK so far I have seen that removing serverSide fixes the problem but then the date range function stops working
Another step forward I think, I have replaced the initComplete with drawCallback, it still only shows the current page layout but at least is shows up even if the date has been filtered or paged to another page.