Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

51
Views
Next page of paginationType input of Datatable upon submit does not display the searched in first page

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

enter image description here

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.

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs