hellow good morning. I’m having trouble in my search function and in need of dire help. my code pagination is limited to 10 per page but when i use my search function it only filters the 1st page data and not all the page and display the data i want and searched. this is in my report.php
heres an example of my table
"" <!-- Riders Report -->
<div class="table-responsive">
<h3><?= __('Riders Report') ?></h3>
<input type="text" id="riderReportSearch" oninput="filterTable('riderReportTable', 'riderReportSearch')" placeholder="Search for riders...">
<table id="riderReportTable" class="table table-hover table-bordered">
<thead>
<tr>
<th><?= $this->Paginator->sort('created') ?></th>
<th><?= $this->Paginator->sort('action') ?></th>
<th><?= $this->Paginator->sort('rider code') ?></th>
<th><?= $this->Paginator->sort('Rider image') ?></th>
<th><?= $this->Paginator->sort('first name') ?></th>
<th><?= $this->Paginator->sort('last name') ?></th>
<th><?= $this->Paginator->sort('contact #') ?></th>
<th><?= $this->Paginator->sort('address') ?></th>
<th><?= $this->Paginator->sort('license') ?></th>
<th><?= $this->Paginator->sort('OR') ?></th>
<th><?= $this->Paginator->sort('CR') ?></th>
<th><?= $this->Paginator->sort('expire date') ?></th>
<th><?= $this->Paginator->sort('brand') ?></th>
<th><?= $this->Paginator->sort('model') ?></th>
<th><?= $this->Paginator->sort('plate #') ?></th>
<th><?= $this->Paginator->sort('motor img') ?></th>
</tr>
</thead>
<tbody class="table-group-divider table-divider-color">
<?php foreach ($riderLogs as $riderLog) : ?>
<tr>
<td><?= $riderLog->created ?></td>
<td><?= $riderLog->action ?></td>
<td><?= $riderLog->rider_id ?></td>
<td><?= $riderLog->image ?></td>
<td><?= $riderLog->first_name ?></td>
<td><?= $riderLog->last_name ?></td>
<td><?= $riderLog->contact ?></td>
<td><?= $riderLog->address ?></td>
<td><?= $riderLog->license ?></td>
<td><?= $riderLog->official_receipt ?></td>
<td><?= $riderLog->certificate_registration ?></td>
<td><?= $riderLog->expire_date ?></td>
<td><?= $riderLog->brand ?></td>
<td><?= $riderLog->model ?></td>
<td><?= $riderLog->plate ?></td>
<td><?= $riderLog->motor ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="paginator">
<ul class="pagination pagination-md justify-content-center mt-5">
<?= $this->Paginator->prev('« Previous', ['model' => 'RiderLogs', 'url' => ['?' => ['scope' => 'riderLogsPagination']]]) ?>
<?= $this->Paginator->numbers(['model' => 'RiderLogs', 'url' => ['?' => ['scope' => 'riderLogsPagination']]]) ?>
<?= $this->Paginator->next('Next »', ['model' => 'RiderLogs', 'url' => ['?' => ['scope' => 'riderLogsPagination']]]) ?>
</ul>
<p><?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p>
<div style="text-align: right; margin-top: 20px;">
<button onclick="printSection('riderReportTable')">Print Rider Report</button>
</div>
</div>
</div>
and this is my script for filtering searches
function filterTable(tableId, inputId) {
var input, filter, table, tr, td, i, j, txtValue;
input = document.getElementById(inputId);
filter = input.value.toUpperCase();
table = document.getElementById(tableId);
tr = table.getElementsByTagName("tr");
// Loop through all table rows
for (i = 0; i < tr.length; i++) {
// Loop through all columns in each row
for (j = 0; j < tr[i].cells.length; j++) {
td = tr[i].getElementsByTagName("td")[j];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
break; // Break the inner loop to avoid displaying the same row multiple times
} else {
tr[i].style.display = "none";
}
}
}
}
}