Bootstrap 5 Orders Table with Search, Filter and Pagination
A customer orders table with live search, a status filter, a rows-per-page selector and numbered pagination. Status badges use colour for meaning and each row has an action button with a tooltip.
<section class="wdw-stage">
<div class="container" style="max-width:1000px">
<div class="wdw-card overflow-hidden" id="orders">
<div class="p-4 d-flex flex-wrap align-items-center justify-content-between gap-3 border-bottom">
<div>
<span class="wdw-eyebrow">Sales</span>
<h2 class="wdw-heading h4 mb-0">Order details</h2>
</div>
<div class="d-flex gap-2">
<button type="button" class="btn btn-outline-secondary text-body rounded-pill btn-sm px-3">Export</button>
<button type="button" class="btn btn-primary rounded-pill btn-sm px-3" id="ordRefresh">Refresh</button>
</div>
</div>
<div class="p-4 pb-3 row g-2">
<div class="col-12 col-md-6">
<label class="visually-hidden" for="ordSearch">Search customers</label>
<input type="search" id="ordSearch" class="form-control" placeholder="Search customer or city">
</div>
<div class="col-6 col-md-3">
<label class="visually-hidden" for="ordStatus">Status</label>
<select id="ordStatus" class="form-select"><option value="">All statuses</option><option>Delivered</option><option>Shipped</option><option>Pending</option><option>Cancelled</option></select>
</div>
<div class="col-6 col-md-3">
<label class="visually-hidden" for="ordSize">Rows per page</label>
<select id="ordSize" class="form-select"><option value="5">5 per page</option><option value="8">8 per page</option><option value="12">12 per page</option></select>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 ord-table">
<thead><tr><th scope="col" class="d-none d-md-table-cell">#</th><th scope="col">Customer</th><th scope="col" class="d-none d-md-table-cell">Location</th><th scope="col" class="d-none d-md-table-cell">Order date</th><th scope="col">Status</th><th scope="col" class="text-end">Amount</th><th scope="col" class="text-end"><span class="visually-hidden">Action</span></th></tr></thead>
<tbody>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">1</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=11" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Michael Holz</span></div></td>
<td class="d-none d-md-table-cell">London</td>
<td class="d-none d-md-table-cell text-body-secondary">Jun 15, 2017</td>
<td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
<td class="text-end fw-semibold">$254</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1001" aria-label="View order 1001"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">2</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=5" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Paula Wilson</span></div></td>
<td class="d-none d-md-table-cell">Madrid</td>
<td class="d-none d-md-table-cell text-body-secondary">Jun 21, 2017</td>
<td data-status="Shipped"><span class="badge rounded-pill ord-shipped">Shipped</span></td>
<td class="text-end fw-semibold">$1,260</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1002" aria-label="View order 1002"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">3</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=33" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Antonio Moreno</span></div></td>
<td class="d-none d-md-table-cell">Berlin</td>
<td class="d-none d-md-table-cell text-body-secondary">Jul 04, 2017</td>
<td data-status="Cancelled"><span class="badge rounded-pill ord-cancelled">Cancelled</span></td>
<td class="text-end fw-semibold">$350</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1003" aria-label="View order 1003"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">4</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=47" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Mary Saveley</span></div></td>
<td class="d-none d-md-table-cell">New York</td>
<td class="d-none d-md-table-cell text-body-secondary">Jul 16, 2017</td>
<td data-status="Pending"><span class="badge rounded-pill ord-pending">Pending</span></td>
<td class="text-end fw-semibold">$1,572</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1004" aria-label="View order 1004"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">5</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=15" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Martin Sommer</span></div></td>
<td class="d-none d-md-table-cell">Paris</td>
<td class="d-none d-md-table-cell text-body-secondary">Aug 04, 2017</td>
<td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
<td class="text-end fw-semibold">$580</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1005" aria-label="View order 1005"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">6</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=45" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Sophie Laurent</span></div></td>
<td class="d-none d-md-table-cell">Paris</td>
<td class="d-none d-md-table-cell text-body-secondary">Aug 11, 2017</td>
<td data-status="Shipped"><span class="badge rounded-pill ord-shipped">Shipped</span></td>
<td class="text-end fw-semibold">$420</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1006" aria-label="View order 1006"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">7</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=52" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Liam O'Connor</span></div></td>
<td class="d-none d-md-table-cell">Dublin</td>
<td class="d-none d-md-table-cell text-body-secondary">Aug 19, 2017</td>
<td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
<td class="text-end fw-semibold">$980</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1007" aria-label="View order 1007"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">8</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=59" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Yuki Tanaka</span></div></td>
<td class="d-none d-md-table-cell">Tokyo</td>
<td class="d-none d-md-table-cell text-body-secondary">Aug 27, 2017</td>
<td data-status="Pending"><span class="badge rounded-pill ord-pending">Pending</span></td>
<td class="text-end fw-semibold">$310</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1008" aria-label="View order 1008"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">9</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=32" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Ana Silva</span></div></td>
<td class="d-none d-md-table-cell">Lisbon</td>
<td class="d-none d-md-table-cell text-body-secondary">Sep 02, 2017</td>
<td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
<td class="text-end fw-semibold">$1,890</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1009" aria-label="View order 1009"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">10</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=60" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Noah Becker</span></div></td>
<td class="d-none d-md-table-cell">Berlin</td>
<td class="d-none d-md-table-cell text-body-secondary">Sep 09, 2017</td>
<td data-status="Cancelled"><span class="badge rounded-pill ord-cancelled">Cancelled</span></td>
<td class="text-end fw-semibold">$75</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1010" aria-label="View order 1010"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">11</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=26" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Elena Rossi</span></div></td>
<td class="d-none d-md-table-cell">Madrid</td>
<td class="d-none d-md-table-cell text-body-secondary">Sep 14, 2017</td>
<td data-status="Shipped"><span class="badge rounded-pill ord-shipped">Shipped</span></td>
<td class="text-end fw-semibold">$640</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1011" aria-label="View order 1011"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
<tr>
<td class="d-none d-md-table-cell text-body-secondary">12</td>
<td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=68" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Chris Evans</span></div></td>
<td class="d-none d-md-table-cell">London</td>
<td class="d-none d-md-table-cell text-body-secondary">Sep 22, 2017</td>
<td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
<td class="text-end fw-semibold">$2,150</td>
<td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1012" aria-label="View order 1012"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
</tr>
</tbody>
</table>
<p class="text-center wdw-muted py-5 mb-0 d-none" id="ordEmpty">No orders match your filters.</p>
</div>
<div class="p-4 d-flex flex-wrap align-items-center justify-content-between gap-3 border-top">
<small class="wdw-muted" id="ordInfo" aria-live="polite"></small>
<nav aria-label="Order pages"><ul class="pagination pagination-sm mb-0" id="ordPages"></ul></nav>
</div>
</div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.ord-table { --bs-table-bg: transparent; }
.ord-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); font-weight: 700; background: var(--bs-tertiary-bg); border-bottom: 0; padding: .85rem 1rem; white-space: nowrap; }
.ord-table td { padding: .85rem 1rem; }
.ord-table td:first-child, .ord-table th:first-child { padding-left: 1.5rem; }
.ord-table td:last-child, .ord-table th:last-child { padding-right: 1.5rem; }
.ord-table img { object-fit: cover; }
.ord-delivered { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.ord-shipped { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); }
.ord-pending { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.ord-cancelled { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.ord-act { display: inline-flex; align-items: center; justify-content: center; }
#ordPages .page-link { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50% !important; margin: 0 .15rem; border: 0; background: transparent; }
#ordPages .page-item.active .page-link { background: var(--bs-primary); color: #fff; }
[data-bs-theme="dark"] #ordPages .page-item.active .page-link { color: #0f1117; }
#ordPages .page-item.disabled .page-link { background: transparent; opacity: .45; }
@media (max-width: 575.98px) {
.ord-table td, .ord-table thead th { padding: .75rem .5rem; }
.ord-table td:first-child, .ord-table th:first-child { padding-left: 1rem; }
.ord-table td:last-child, .ord-table th:last-child { padding-right: 1rem; }
.ord-table img { display: none; }
}
(function initOrdersTable() {
var root = document.getElementById('orders');
if (!root) return;
var rows = Array.prototype.slice.call(root.querySelectorAll('tbody tr'));
var search = document.getElementById('ordSearch');
var status = document.getElementById('ordStatus');
var size = document.getElementById('ordSize');
var pages = document.getElementById('ordPages');
var info = document.getElementById('ordInfo');
var empty = document.getElementById('ordEmpty');
var page = 1;
function render() {
var q = search.value.trim().toLowerCase();
var s = status.value;
var per = parseInt(size.value, 10);
var hits = rows.filter(function (r) {
var okText = !q || r.textContent.toLowerCase().indexOf(q) > -1;
var okStatus = !s || r.querySelector('[data-status]').dataset.status === s;
return okText && okStatus;
});
var total = Math.max(1, Math.ceil(hits.length / per));
if (page > total) page = total;
var start = (page - 1) * per;
rows.forEach(function (r) { r.hidden = true; });
hits.slice(start, start + per).forEach(function (r) { r.hidden = false; });
empty.classList.toggle('d-none', hits.length > 0);
info.textContent = hits.length
? 'Showing ' + (start + 1) + '-' + Math.min(start + per, hits.length) + ' of ' + hits.length + ' orders'
: 'Showing 0 orders';
renderPages(total);
}
function item(label, target, disabled, active, aria) {
var li = document.createElement('li');
li.className = 'page-item' + (disabled ? ' disabled' : '') + (active ? ' active' : '');
var b = document.createElement('button');
b.type = 'button';
b.className = 'page-link';
b.textContent = label;
if (aria) b.setAttribute('aria-label', aria);
if (active) b.setAttribute('aria-current', 'page');
b.disabled = disabled;
b.addEventListener('click', function () { page = target; render(); });
li.appendChild(b);
return li;
}
function renderPages(total) {
pages.textContent = '';
pages.appendChild(item('‹', page - 1, page === 1, false, 'Previous page'));
for (var i = 1; i <= total; i++) pages.appendChild(item(String(i), i, false, i === page, 'Page ' + i));
pages.appendChild(item('›', page + 1, page === total, false, 'Next page'));
}
[search, status, size].forEach(function (el) {
el.addEventListener('input', function () { page = 1; render(); });
});
document.getElementById('ordRefresh').addEventListener('click', function () {
search.value = ''; status.value = ''; page = 1; render();
});
root.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(function (el) { new bootstrap.Tooltip(el); });
render();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.