fnFilter on Individual Columns
fnFilter on Individual Columns
Derek Perkins
Posts: 2Questions: 0Answers: 0
I'm trying to filter on individual columns, but I am creating a custom form to filter on with select boxes, standard input boxes, checkboxes, etc. I know that there is the example that shows how to put input boxes into the footer, but I'm having trouble extending that to my form. This is the code that I have, but it isn't working. Is there something else I need to do to use a separate form to filter?
[code]
jQuery("select[@name=state]").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value , 2 );
} );
jQuery("input[@name=stat]").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, 2 );
} );
[/code]
[code]
jQuery("select[@name=state]").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value , 2 );
} );
jQuery("input[@name=stat]").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, 2 );
} );
[/code]
This discussion has been closed.
Replies
Which aspect of this isn't working? The only thing that I can see which is immediately odd about this is that you typically don't use 'keyup' for a SELECT element - you would use 'change'. Does it work as you would expect if you make this change?
If not, perhaps you could explain a little more about what is actually happening (or not happning as the case might be) and if you have a link you could post, that would be more useful.
Regards,
Allan
One possible for fnFilter not working: If you've set { bFilter: false } in the tables settings in order to remove the default search box, doing so also disables all other filtering features, including fnFilter.
A good way to turn off the default search box without disabling your own custom filters is to use sDom and don't include 'f'.
For example, for a table with the default layout but no search box, without disabling fnFilter, you would use { sdom: 'lrtip' }
Allan