filtering individual columns using select menus
filtering individual columns using select menus
I am using the DataTables individual column filtering example (using select menus).
the below code adds select menu filter for all the columns,how do i modify the code to display few select menu filters (say only 3 filters out of the 5 columns.)
[code]
/* Add a select menu for each TH element in the table footer */
$("tfoot th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
} );
[/code]
to be more specific i modified the code as below:to enable filter only on cols 0,1,4 & 5
This disables the filter but shows the cols 2 & 3 select menus, is there a way where i cannot see the selectmenus for columns 2 & 3
[code]
/* Initialise the DataTable */
var oTable = $('#example').dataTable( {
//"oLanguage": {
//"sSearch": "Search all columns:"
//}
"aoColumns": [
{ "bFilter": [0] },
{ "bFilter": [1] },
{ "bFilter": [4] },
{ "bFilter": [5] },
],
"aaSorting": [[0, 'asc']]
} );
[/code]
the below code adds select menu filter for all the columns,how do i modify the code to display few select menu filters (say only 3 filters out of the 5 columns.)
[code]
/* Add a select menu for each TH element in the table footer */
$("tfoot th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
} );
[/code]
to be more specific i modified the code as below:to enable filter only on cols 0,1,4 & 5
This disables the filter but shows the cols 2 & 3 select menus, is there a way where i cannot see the selectmenus for columns 2 & 3
[code]
/* Initialise the DataTable */
var oTable = $('#example').dataTable( {
//"oLanguage": {
//"sSearch": "Search all columns:"
//}
"aoColumns": [
{ "bFilter": [0] },
{ "bFilter": [1] },
{ "bFilter": [4] },
{ "bFilter": [5] },
],
"aaSorting": [[0, 'asc']]
} );
[/code]
This discussion has been closed.
Replies
btw datatables is an amazing plugin, superb job!
But it would be more ideal not to have them in the first place.
Datatables is an amazing plugin with lot of functionality and implementations.
Appreciate the amazing work.