reset filter
reset filter
santiagozky
Posts: 8Questions: 0Answers: 0
Hello,
I have implemented a small piece of code to allow the user search in a particular column. My problem is that if the user change the column and perform a second search the search is performed over the results of the previous search.
So if I do a search in the 3 column and get 50 results and then I search in the 1 column I will only be searching within t 50 results, not the entire data.
Here is the code:
[code]
//the div with the search input
var elDiv=$("#example_filter > input");
//I create a select that will be populated with the column names
var select = document.createElement( 'select' );
select.setAttribute("name","columna");
$(elDiv).before(select);
//I add the options to the select
var aoColumns = oTable.fnSettings().aoColumns;
for(var i=0;i
I have implemented a small piece of code to allow the user search in a particular column. My problem is that if the user change the column and perform a second search the search is performed over the results of the previous search.
So if I do a search in the 3 column and get 50 results and then I search in the 1 column I will only be searching within t 50 results, not the entire data.
Here is the code:
[code]
//the div with the search input
var elDiv=$("#example_filter > input");
//I create a select that will be populated with the column names
var select = document.createElement( 'select' );
select.setAttribute("name","columna");
$(elDiv).before(select);
//I add the options to the select
var aoColumns = oTable.fnSettings().aoColumns;
for(var i=0;i
This discussion has been closed.
Replies
I think the problem is that what is happening is:
1. User selects a column to search on using the 'select' menu
2. Enters search string and this is applied to that column
3. User selects a different column using the 'select' menu
4. The global search is cleared, but NOT the search on the individual column from before
5. Enters search string into input box, and is now doing an 'AND' search between the value first entered for the first column, and the value entered for the second column!
So the key step here is 4. What you need to do, rather than clearing the global filter, is clear the old column specific filter ( $oTable.fnFilter("", whatever_the_last_index_was); for example).
Hope this helps,
Allan
Thanks allan.