Reputation: 41
Hi I am trying to add add select tag outside the table and make it filter a specific column in the table.
Several others have asked about this, but all the 'working' examples I have found are actually not working:
Here is an example:
<select id="select1" data-column="1">
<option value="">First Name</option>
</select>
var arry = $.tablesorter.filter.getOptionSource($t[0], 1);
$('#select1').append('<option>' + arry.join('</option><option>') + '</option>');
Has something changed with the plugin?
All guidance are appreciated.
Thanks.
Upvotes: 2
Views: 649
Reputation: 86403
Actually there was a bug in the last update which has been fixed and is currently only available within the working branch (patch).
// line 1143 - 1144 of jquery.tablesorter.widgets.js
ffxn = wo.filter_columnFilters ?
c.$filters.add(c.$externalFilters).filter('[data-column="'+ columnIndex + '"]').find('select option:selected').attr('data-function-name') || '' : '';
Here is an updated demo using the working branch code.
I'll push an update today to get this fix into the master. Sorry about that.
Master branch updated. The demo from your question is working now.
Upvotes: 1