JQuery DataTables Filtering for Specific Columns Only?

You can modify your selector to ignore the first td element. The index of each matched element should be 1 less than the corresponding column index.

You can modify your selector to ignore the first element. The index of each matched element should be 1 less than the corresponding column index. /* Add a select menu for each TH element except the first in the table footer */ $("thead #filter td:not(:eq(0))").

Each( function ( I ) { var columnIndex = I + 1; this. InnerHTML = fnCreateSelect( oTable. FnGetColumnData(columnIndex) ); $('select', this).

Change( function () { oTable. FnFilter( $(this).val(), columnIndex ); } ); }); If you wanted to be able to specify the column indexes for which you wanted a filter, one way would be to do something like var filterIndexes = 3, 4; $('td', '#filter'). Each( function ( I ) { if ($.

InArray(i, filterIndexes)) { this. InnerHTML = fnCreateSelect( oTable. FnGetColumnData(i) ); $('select', this).

Change( function () { oTable. FnFilter( $(this).val(), I ); }); } }); Or, if you wanted to control filters by adding a class . Filter to any element whose column you wanted to filter, you could do something like $('th', '#labels').

Each( function(i) { if ($(this). HasClass( 'filter' )) { $('td', '#filter'). Eq(i) .

Html( fnCreateSelect(oTable. FnGetColumnData(i)) ) . Find('select') .

Change(function () { oTable. FnFilter($(this).val(), i); }); } }); Not tested, but you get the idea :).

That worked perfectly...thanks! :) – Michael Nov 5 at 22:47 What if I wanted to remove the select filters from columns two and three also? – Michael Nov 6 at 3:24 @Michael, see updated answer.

– Doug Owings Nov 6 at 3:50.

This is the best way for insert Filter for Specific Column.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions