I'd tried using the paginationType
plugin for Datatable
to be enable to use jump to page function I used the input
paginationType
plugin.
I have implemented the input
plugin but I found an error when submitting the form
For example I have 2 pages in the datatable
I put the page 2 in the input
field of the paginationType
and then in my form I searched for a username where was displayed on page 1. Upon submit, it doesn't display any result. But when I try to searched while in page 1 on that username it displays the result.
What I tried to do is this
$('body').on('submit','#search-form', function(){
if ( ! $.fn.DataTable.isDataTable('#userstable') ) {
$('#userstable tbody').empty();
}else{
$('#userstable tbody').empty();
$('#userstable').DataTable().clear();
$('#userstable').DataTable().destroy();
}
$('#userstable').DataTable();
});
I tried to destroy the table then reinitialize it but upon doing this it still displays no result
and the floatingScroll
for the datatable
is broken.
Here is the link to the plugin I used
https://datatables.net/plug-ins/pagination/input
Thank you in advance.