Skip to content

Commit

Permalink
Merge pull request #21210 from abpframework/9.0-permission-search-mvc
Browse files Browse the repository at this point in the history
Set the first tab active after search in permissions
  • Loading branch information
oykuermann authored Nov 7, 2024
2 parents 02fcb96 + 8da56d6 commit 60fd0c2
Showing 1 changed file with 14 additions and 1 deletion.
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 All @@ -304,7 +305,7 @@ var abp = abp || {};
return;
}

var tabName = $tabItem.find('small').text().toLowerCase();
var tabName = $tabItem.text().toLowerCase();

var tabContentFilters = $($tabItem.attr('href')).find('[data-filter-text]');
let includedInTabContent = false;
Expand All @@ -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

0 comments on commit 60fd0c2

Please sign in to comment.