Skip to content

A free open source IT asset/license management system

Fixed weird BS tables search text local storage issue

snipe6e3567f0bf53
diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php
index 4e4a443ae5..f3717e4196 100644
--- a/resources/views/partials/bootstrap-table.blade.php
+++ b/resources/views/partials/bootstrap-table.blade.php
@@ -1993,6 +1993,20 @@
});
};
+ $("[name='clearSearch']").click(function () {
+
+ // This hacks around a stupid issue in BS tables where the search text would get remembered for way too long even after it was cleared
+ for (storedSearch in localStorage) {
+ if (storedSearch.endsWith('.bs.table.searchText')) {
+ localStorage.removeItem(storedSearch);
+ }
+ }
+
+ $('.search-input').each(function (index, element) {
+ $(element).val('');
+ });
+ });
+
$('.search button[name=clearSearch]').click(searchboxHighlighter);
searchboxHighlighter({ name:'pageload'});
$('.search-input').keyup(searchboxHighlighter);