wyszukiwanie i dodawanie sugestii oraz poprawki
This commit is contained in:
@@ -66,7 +66,7 @@ function bindDeleteButton(button) {
|
||||
const syncBtn = cell.querySelector('.sync-btn');
|
||||
if (syncBtn) bindSyncButton(syncBtn);
|
||||
} else {
|
||||
cell.innerHTML = '<span class="badge rounded-pill bg-warning opacity-75">Usunięto synchronizacje</span>';
|
||||
cell.innerHTML = '<span class="badge rounded-pill bg-warning opacity-75">Usunięto z bazy danych</span>';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
|
28
static/js/table_search.js
Normal file
28
static/js/table_search.js
Normal file
@@ -0,0 +1,28 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const searchInput = document.getElementById("search-table");
|
||||
const clearButton = document.getElementById("clear-search");
|
||||
const rows = document.querySelectorAll("table tbody tr");
|
||||
|
||||
if (!searchInput || !rows.length) return;
|
||||
|
||||
function filterTable(query) {
|
||||
const q = query.toLowerCase();
|
||||
|
||||
rows.forEach(row => {
|
||||
const rowText = row.textContent.toLowerCase();
|
||||
row.style.display = rowText.includes(q) ? "" : "none";
|
||||
});
|
||||
}
|
||||
|
||||
searchInput.addEventListener("input", function () {
|
||||
filterTable(this.value);
|
||||
});
|
||||
|
||||
if (clearButton) {
|
||||
clearButton.addEventListener("click", function () {
|
||||
searchInput.value = "";
|
||||
filterTable(""); // Pokaż wszystko
|
||||
searchInput.focus();
|
||||
});
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user