Combination of Individual and Custom Column Filtering?
Combination of Individual and Custom Column Filtering?
Hello everyone,
First, I'd like to say I am absolutely loving DataTables.
What I'm trying to do is add Microsoft Excel like column filtering functionality to each column in my DataTable. So for example, for each column in my DataTable there is a dropdown box with the options "Contains, Does Not Contain, Is Equal To, Is Not Equal To" followed by a textbox at the bottom. The idea is that a user can filter the table by selecting one of the options and typing something into the text box, and depending on what they have selected (e.g., "Contains") the table will be filtered accordingly based only on that column's filter inputs.
I realize I can use the fnFilter function to sort only a specific column with a value and an index of the column I wish to filter... but I have no control over what filtering the fnFilter function performs. So is there a way for me to say "I want to filter only on this column using my custom filter function?"
So is there something where I could do like:
[code]
oTable.fnFilter( this.value, $("tfoot input").index(this), true, function(){
//some logic here returning true to keep the row, false to get rid of it
});
[/code]
Input parameters:
1. string : String to filter on.
2. int (optional): Column to limit filtering to - default null. Note that the column counting index starts at zero.
3. bool (optional) : Escape regular special characters or not - default true.
4. function to use for custom filtering
Of course, I know this code isn't valid, but is there someway to mimic this functionality?
Thanks again!
First, I'd like to say I am absolutely loving DataTables.
What I'm trying to do is add Microsoft Excel like column filtering functionality to each column in my DataTable. So for example, for each column in my DataTable there is a dropdown box with the options "Contains, Does Not Contain, Is Equal To, Is Not Equal To" followed by a textbox at the bottom. The idea is that a user can filter the table by selecting one of the options and typing something into the text box, and depending on what they have selected (e.g., "Contains") the table will be filtered accordingly based only on that column's filter inputs.
I realize I can use the fnFilter function to sort only a specific column with a value and an index of the column I wish to filter... but I have no control over what filtering the fnFilter function performs. So is there a way for me to say "I want to filter only on this column using my custom filter function?"
So is there something where I could do like:
[code]
oTable.fnFilter( this.value, $("tfoot input").index(this), true, function(){
//some logic here returning true to keep the row, false to get rid of it
});
[/code]
Input parameters:
1. string : String to filter on.
2. int (optional): Column to limit filtering to - default null. Note that the column counting index starts at zero.
3. bool (optional) : Escape regular special characters or not - default true.
4. function to use for custom filtering
Of course, I know this code isn't valid, but is there someway to mimic this functionality?
Thanks again!
This discussion has been closed.