mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
This commit is contained in:
parent
7c5a85c4c2
commit
948e62168c
@ -712,6 +712,7 @@ ts.filter = {
|
|||||||
var external, wo = table.config.widgetOptions;
|
var external, wo = table.config.widgetOptions;
|
||||||
$el.unbind('keyup search filterReset')
|
$el.unbind('keyup search filterReset')
|
||||||
.bind('keyup search', function(event, filter) {
|
.bind('keyup search', function(event, filter) {
|
||||||
|
var $this = $(this);
|
||||||
// emulate what webkit does.... escape clears the filter
|
// emulate what webkit does.... escape clears the filter
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
@ -722,7 +723,7 @@ ts.filter = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// external searches won't have a filter parameter, so grab the value
|
// external searches won't have a filter parameter, so grab the value
|
||||||
if ($(this).hasClass('tablesorter-filter')) {
|
if ($this.hasClass('tablesorter-filter') && !$this.hasClass('tablesorter-external-filter')) {
|
||||||
external = filter;
|
external = filter;
|
||||||
} else {
|
} else {
|
||||||
external = [];
|
external = [];
|
||||||
@ -1193,24 +1194,20 @@ ts.addWidget({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// look for filter widget
|
// look for filter widget
|
||||||
$table.bind('filterEnd', function() {
|
if ($table.hasClass('hasFilters')) {
|
||||||
if (updatingStickyFilters) { return; }
|
$table.bind('filterEnd', function() {
|
||||||
$stickyThead.find('.tablesorter-filter-row').children().each(function(indx) {
|
// $(':focus') needs jQuery 1.6+
|
||||||
$(this).find(filterInputs).val( c.$filters.find(filterInputs).eq(indx).val() );
|
if ( $(document.activeElement).closest('thead')[0] !== $stickyThead[0] ) {
|
||||||
|
// don't update the stickyheader filter row if it already has focus
|
||||||
|
$stickyThead.find('.tablesorter-filter-row').children().each(function(indx) {
|
||||||
|
$(this).find(filterInputs).val( c.$filters.find(filterInputs).eq(indx).val() );
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
$stickyCells.find(filterInputs).bind('keyup search change', function(event) {
|
ts.filter.bindSearch( $table, $stickyCells.find('.tablesorter-filter').addClass('tablesorter-external-filter') );
|
||||||
// ignore arrow and meta keys; allow backspace
|
}
|
||||||
if ((event.which < 32 && event.which !== 8) || (event.which >= 37 && event.which <=40)) { return; }
|
|
||||||
updatingStickyFilters = true;
|
|
||||||
var $f = $(this), column = $f.attr('data-column');
|
|
||||||
c.$filters.find(filterInputs).eq(column)
|
|
||||||
.val( $f.val() )
|
|
||||||
.trigger('search');
|
|
||||||
setTimeout(function() {
|
|
||||||
updatingStickyFilters = false;
|
|
||||||
}, wo.filter_searchDelay);
|
|
||||||
});
|
|
||||||
$table.trigger('stickyHeadersInit');
|
$table.trigger('stickyHeadersInit');
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user