-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change widgetOptions (or filter all or only one) #490
Comments
Hi @SilverSilencer! Right now there isn't an easy way to make any match work as you describe. But good news is I've been working on it so that what you are describing is possible. All I would need to do is make a few tweaks to make the input switch dynamically from searching all columns to a selected column. I wonder though, should we make it easier for the user, so they don't need to use an attached select? Maybe have them include a prefix, something like I'm not sure if that would be intuitive... |
Yeah, that would be great. Easy way is always welcomed, but if it's limited usage, it's better to do both if it's possible, otherwise it's better to use more extended way. |
Check out the new external inputs demo... the top search has a column/all column selector. |
I just can get this to work. When I use this no matter what I write all fields are shown and are not filtered. At my first code I changed and then added: Because I have 21 columns. And whatever I write all rows are snown when I use option with value "all". |
Hi @SilverSilencer! Here is a basic demo to show you it works: HTML <button>Find "10"</button>
<table class="tablesorter">
...
</table> $('table').tablesorter({
theme: 'blue',
widgets: ['zebra', 'filter']
});
$('button').on('click', function(){
var filters = [];
// the table only has 4 columns, so set the search on the 5th
// to match in any column; remember this number is zero-based
filters[4] = "10";
$('table').trigger('search', [ filters ]);
}); If you share the code you are using, I can try to help troubleshoot the problem. |
I think I got it to work now. I had to remove class "search" from input and change |
I made two fields (input text and select), where I can write search text and select which column should be filtered. That works great, but I don't know how to add option to search all fields (with OR not AND).
Is there any way to change widgetOptions (maybe that would work if I change filter_anyMatch to true when user decides to seaerch all fields not only one). This is what I have so far:
wherewesearch = document.getElementById("dropdownsearch").value;
whatwesearch = document.getElementById("filtersearch").value;
$('.table').trigger('filterReset');
var columns = [];
if (selectedvalue == "0") {
// What to do here? To enable search all fields?
} else {
columns[wherewesearch] = whatwesearch;
$('.table').trigger('search', [columns]);
}
The text was updated successfully, but these errors were encountered: