jquery - Looking for a way to use a select2 control with an internal filter widget of tablesorter -
internal filter widget opposed external 1 outlined in example:
http://mottie.github.io/tablesorter/beta-testing/example-external-filters-using-select2.html
i looking behavior similar first 2 external filter boxes placeholders: alphanumeric , alphanumeric tag want behavior inside of table. here tried do:
<th class="filter-select2" data-placeholder="select something"> this not work, if change "filter-select2" "filter-select", does.
i looking way hack/customize existing tablesorter behavior allow using select2 internally. not know js , library enough attempt on own.
here javascript snippet use initialize tablesorter library.
$('#table1').tablesorter({ theme : 'ice', cssinfoblock : 'tablesorter-no-sort', widgets: ['zebra', 'stickyheaders', 'filter'] });
i added filter formatter code select2 plugin. use follows:
$('table').tablesorter({ theme: 'blue', widthfixed: true, widgets: ['zebra', 'filter'], widgetoptions : { filter_reset : 'button.reset', filter_formatter : { // alphanumeric (match) 0 : function($cell, indx){ return $.tablesorter.filterformatter.select2( $cell, indx, { match : true, // adds "filter-match" header celltext : 'match: ', width: '85%' }); } } } });
Comments
Post a Comment