Makes filter keep focus when hiding/showing sticky

The filter doesn't change the focused element when showing or hiding the sticky header. This fixes it.
This commit is contained in:
samgrrehder 2020-02-11 15:42:07 -03:00 committed by GitHub
parent 6a32e5acc2
commit 22335d67a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,6 +206,18 @@
.addClass( state )
.css(cssSettings);
}
if (isVisible !== laststate) {
// make sure the focused filter stay focused after showing/hiding sticky
var $td = $(document.activeElement).closest('td'),
column = $td.parent().children().index($td);
if (column >= 0 && c.$filters) {
if (isVisible === "hidden") {
c.$filters.eq(column).find('a, select, input').focus();
} else {
$stickyTable.find('a, select, input').eq(column).focus();
}
}
}
if (isVisible !== laststate || resizing) {
// make sure the column widths match
resizeHeader();