Some problem with "lengthMenu" ...
Some problem with "lengthMenu" ...
rabitona
Posts: 1Questions: 0Answers: 0
Hello ! I can active the drop menu to change the number of issues on my page.
My code :
<script type="text/javascript">
$(document).ready(function() {
$('#resultats').DataTable( {
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel'
],
initComplete: function () {
<?php if(isset($_SESSION['user'])){?>
this.api().columns('th:gt(1)').every( function () {
<?php }else{ ?>
this.api().columns('th:gt(0)').every( function () {
<?php } ?>
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>' )
} );
} );
}
} );
} );
</script>
Somebody can explain me why ? :)
Thx ! :D
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Replies
Do you mean you can't activate the dropdown? If so, please link to a page showing the issue, per the forum rules, so it can be debugged.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
Thanks,
Allan