Search in set of colums
Search in set of colums
I have the following problem. I have a set of n columns. One of this column (A) is a filter (triggered by a drop-down menu). Furthermore, I have a search field that should search in all table columns except (A). I am quite near to make it work: filter in column A works fine; my search from the search field excludes column A. However, the following code to search in the other columns (in this case 0 and 1) doesn't work. Searches are performed only in column 0.
$('#myInputTextField').keyup(function(){
table.column( [0 ,1 ] ).search( $(this).val() ).draw();
})
Any idea?
Answers
You need to change
table.column( [0 ,1 ] )
totable.columns( [0 ,1 ] ).
. Notice the plural columns,Kevin
Thank you for your help. With this change it seams to me that it show rows where all columns (0,1) maches the search string (AND). But it should be OR to fullfill my requirements.
Yes, the search is an
AND
between the columns. You would need to create a custom search. I suggest looking at creating a search plugin:https://datatables.net/manual/plug-ins/search
Kevin
Thanks, Kevin. I solved it this way: