Skip to content
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

Set the first tab active after search in permissions #21210

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ var abp = abp || {};
$permissionSearchInput.keyup(throttle(function() {
var searchTerm = $permissionSearchInput.val().toLowerCase();
filterTabs(searchTerm);
setFirstVisibleTabActive();
}, 300));

function filterTabs(searchTerm) {
Expand Down Expand Up @@ -324,6 +325,18 @@ var abp = abp || {};
});
}

function setFirstVisibleTabActive() {
$('#PermissionsTabsContent .tab-pane').removeClass('active show');

var $tabs = $('#PermissionsTabs .nav-link');
var $firstVisibleTab = $tabs.filter(':visible').first();
$tabs.removeClass('active');
$firstVisibleTab.addClass('active');

var $firstVisibleTabContent = $($firstVisibleTab.attr('href'));
$firstVisibleTabContent.addClass('active show');
}

function throttle(mainFunction, delay) {
let timerFlag = null; // Variable to keep track of the timer

Expand Down
Loading