Commit 7628a6c8 authored by webchick's avatar webchick
Browse files

Issue #1925492 by visabhishek, nod_, mkadin | YesCT: Small optimization for search on modules page.

parent 1b79de3d
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
var $input = $('input.table-filter-text').once('table-filter-text'); var $input = $('input.table-filter-text').once('table-filter-text');
var $table = $($input.attr('data-table')); var $table = $($input.attr('data-table'));
var $rowsAndDetails, $rows, $details; var $rowsAndDetails, $rows, $details;
var searching = false;
function hidePackageDetails(index, element) { function hidePackageDetails(index, element) {
var $details = $(element); var $details = $(element);
var $visibleRows = $details.find('table:not(.sticky-header)').find('tbody tr:visible'); var $visibleRows = $details.find('table:not(.sticky-header)').find('tbody tr:visible');
...@@ -36,13 +36,15 @@ ...@@ -36,13 +36,15 @@
// Filter if the length of the query is at least 2 characters. // Filter if the length of the query is at least 2 characters.
if (query.length >= 2) { if (query.length >= 2) {
searching = true;
$rows.each(showModuleRow); $rows.each(showModuleRow);
// Hide the package <details> if they don't have any visible rows. // Hide the package <details> if they don't have any visible rows.
// Note that we first show() all <details> to be able to use ':visible'. // Note that we first show() all <details> to be able to use ':visible'.
$details.show().each(hidePackageDetails); $details.show().each(hidePackageDetails);
} }
else { else if (searching) {
searching = false;
$rowsAndDetails.show(); $rowsAndDetails.show();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment