Hi all,
Here's the table I'm working on: http://cxc.harvard.edu/target_lists/large_projects/BPs.html and I'd like to only let users sort by the 3rd or 5th column since sorting by the other columns isn't very meaningful.
I found this post: https://www.datatables.net/forums/discussion/21425/is-it-possible-to-limit-individual-column-filtering-select-inputs-to-specific-columns#Comment_61847 which seems like exactly what I want to do, but I'm still new to javascript and I'm having trouble translating the code in the answer to what I'm working with.
Here's the relevant snippet from my code (taken straight from the example here: https://www.datatables.net/examples/api/multi_filter_select.html):
'''
initComplete: function () {
this.api().columns().every( function () {
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>' )
} );
} );
}
'''
Any and all help appreciated.