-
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
filter widget - filter column by multiple values #717
Comments
Hi @roeycohen! Is that a custom select? How are the checkboxes getting added? Anyway, currently, this isn't possible to do with a select within the filter row; but here is a demo to add an external multi-select: HTML <select class="search" multiple>
<option></option> <!-- empty option to clear filter -->
</select> Script var targetColumn = 3; // age column
$('table').tablesorter({
widgets: ['zebra', 'filter'],
widgetOptions: {
filter_columnFilters : true
},
initialized : function(table) {
// get all values from the age column
var opts = $.tablesorter.filter.getOptionSource( table, targetColumn );
$('.search')
.append('<option>' + opts.join('</option><option>') + '</option>')
.on('change', function(){
var filters = [];
// set filter for "Age" column
filters[targetColumn] = $(this).find(':selected').map(function(){
return this.value;
}).get().join('|');
$.tablesorter.setFilters( table, filters, true );
});
}
}); |
Hi, Thank you for you answer. The sample isn't very elegant, so for now i'll pass it :) About the special drop down, it is a custom select, you may find it here: this project is not being maintained anymore... (so maybe embedding its code directly in the tablesorter library may be better). Roey |
This would be an excellent addition - the external select is not very user-friendly. Any plans to add this support? |
I tried the demo(http://jsfiddle.net/abkNM/3935/) and it just has a lot of [object Object] in it. I tried implementing the source to what I have and couldn't get it working either. And the option @roeycohen linked is 404 not found, doh! If selecting multiple options within a filter could be added, that would be very awesome addition to an already awesome plugin! Mottie, thank you for what you've done already! |
Hi @Zero2Cool! Thanks! I've been super busy so I haven't had much time to work on this plugin, but I did update the demo - http://jsfiddle.net/abkNM/9473/ |
I'd love to see this option. Thanks! P.S. Could also use Ctrl- and Shift-Click to select multiple items, if checkboxes don't work out. (But I like the checkboxes. ;-) |
hi,
is it possible using the filer-select option to select more than one options?
maybe something like this:
thanks,
Roey
The text was updated successfully, but these errors were encountered: