Few simple bits?! Remove default sort order, edit default limit entries, add print/export button
Few simple bits?! Remove default sort order, edit default limit entries, add print/export button
Hi all
I'm using the example:
https://datatables.net/examples/api/multi_filter.html
I would like to leave the ability to sort items however I would like to remove the default sort order (reason being the default sort is performed in T SQL on a column that is not being displayed in the data set)
Also I would like to edit the "Show x entries" menu, I would like to default it to 100 but also add in extra options e.g. 500 and 1000
I would like to add a print button and an export to excel button is this possible?
The J Script I'm currently using is:
<script>
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#example thead th').each( function () {
var title = $(this).text();
$(this).append( '<input type="text" class="filter_box" placeholder="Filter" />' );
} );
// DataTable
var table = $('#example').DataTable();
// Apply the search
table.columns().every( function () {
var that = this;
$( 'input' ).on( 'click', function(e) {
e.stopPropagation();
} );
$( 'input', this.header() ).on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
} );
</script>
Answers
1) Use
order
set to an empty array.2) Use
lengthMenu
.3) Use the Buttons extension.
Allan