javascript - Remove pagination number after search query -


i want remove pagination number in bootstrap pagination, after search queries. working example here: jsfiddle

var $rows = $('#employeestable.table tr.tablebody'); $('#employeesearchbox').bind('keydown keypress keyup change', function () {     var val = $.trim($(this).val()).replace(/ +/g, ' ').tolowercase();     $rows.show().filter(function () {         var firstname = $(this).find('.employeesfirstname').text().replace(/\s+/g, ' ').tolowercase();         var lastname = $(this).find('.employeeslastname').text().replace(/\s+/g, ' ').tolowercase();         var firstandlastname = firstname.concat(" "+lastname);         var lastandfirstname = lastname.concat(" "+firstname);         return !~lastname.indexof(val) & !~firstname.indexof(val) & !~firstandlastname.indexof(val) & !~lastandfirstname.indexof(val);      }).hide();         $table.find("tbody tr[style='display: table-row;']").hide().slice(currentpage * numperpage, (currentpage + 1) * numperpage).show(); }); 

i made search query use first name , last name filtering. table showing 5 rows first page in table, when deleting query text in search field showing rows in table , pagination stays same. want fix this, stuck code.

someone has idea how solve this? dont want use datatable.js this.

edit: can add , going work also. example here: jsfiddle

trigger click on active page after filteration trick,

$('#employeesearchbox').bind('keydown keypress keyup change', function () {      var val = $.trim($(this).val()).replace(/ +/g, ' ').tolowercase();      $rows.show().filter(function () {         var firstname = $(this).find('.employeesfirstname').text().replace(/\s+/g, ' ').tolowercase();         var lastname = $(this).find('.employeeslastname').text().replace(/\s+/g, ' ').tolowercase();         var firstandlastname = firstname.concat(" " + lastname);         var lastandfirstname = lastname.concat(" " + firstname);         $(".active").click(); < -----here         return !~lastname.indexof(val) & !~firstname.indexof(val) & !~firstandlastname.indexof(val) & !~lastandfirstname.indexof(val);     }).hide(); }); 

fiddle


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -