I am using the jQuery DataTables plugin in my application and am displaying a set of data with multiple years. When the page loads, I'd like the data to start filtered to the current year. Is it possible to have the plugin filter data when the page loads?
As Datatables API says:
$(document).ready(function() {
oTable = $('#example').dataTable();
/* Filter immediately */
oTable.fnFilter( 'test string' );
} );
If you need to Filter only a specific column, use (zero-based) columnIndex as second parameter:
oTable.fnFilter( 'test string', columnIndex );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With