I am using laravel 5. I have displayed data from database in tables:
<table class="table table-striped table-bordered" id="mytable" >
<thead>
<tr>
<td><strong>#</strong></td>
<td class="text-center col-lg-1"><strong>Seksyen</strong></td>
<td class="text-center col-lg-3"><strong>Kategori</strong></td>
<td class="text-center col-lg3-2"><strong>Pangkat</strong></td>
<td class="text-center col-lg-5"><strong>Nama</strong></td>
<td class="text-center col-lg-1"><strong>No Personal</strong></td>
<td class="text-center"><strong>Lihat Rekod</strong></td>
<td class="text-center"><strong>Edit</strong></td>
</tr>
</thead>
<tbody>
@foreach($itemregistrations as $index => $value)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="text-center">
<a href=""><i class="fa fa-folder fa-fw" rel="tooltip" title="view profil"></i></a></td>
@can('Edit Pegawai','Edit APR','Edit KTA','Edit PTK')
<td class="text-center"><a href=""><i class="fa fa-pencil fa-fw" rel="tooltip" title="edit profil"></i></a></td>
@endcan
</tr>
@endforeach
</tbody>
</table>
I used jquery script for searching in html table like this to perform the filter function:
<script>
// Write on keyup event of keyword input element
$(document).ready(function(){
$("#search").keyup(function(){
_this = this;
// Show only matching TR, hide rest of them
$.each($("#mytable tbody tr"), function() {
if($(this).text().toLowerCase().indexOf($(_this).val().toLowerCase()) === -1)
{
$(this).hide();
}
else
{
$(this).show();
}
});
});
});
</script>
I had display the data tables in pagination. The search can do filter but only what display in the page. It doesn't search through all data in other pagination page.
How to modify the code to search through all pagination pages?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire