Browse Source

add filter query

main
Christoph Marzell 2 weeks ago
parent
commit
d063b993e1
  1. 4
      app/views/entries/index.html.erb

4
app/views/entries/index.html.erb

@ -325,6 +325,7 @@
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.open-delete-modal').forEach(button => {
button.addEventListener('click', function (e) {
e.preventDefault();
const targetUrl = this.getAttribute('href');
document.getElementById('modal-delete-form').setAttribute('action', targetUrl);
@ -340,11 +341,10 @@
const filterInput = document.getElementById("entryFilter");
const table = document.getElementById("entriesTable");
const tableRows = table?.querySelectorAll("tbody tr");
if (filterInput && table && tableRows) {
filterInput.addEventListener("keyup", function () {
const query = this.value.toLowerCase();
console.log(query);
tableRows.forEach(row => {
const text = row.textContent.toLowerCase();
row.style.display = text.includes(query) ? "" : "none";

Loading…
Cancel
Save