josecebe / twbs-pagination

jQuery pagination plugin (bootstrap powered)
http://josecebe.github.io/twbs-pagination/
Other
1.1k stars 401 forks source link

twbs pagination error if result is zero #48

Closed ezekel closed 9 years ago

ezekel commented 9 years ago

why I get error if my count result is zero ?

"Error: Start page option is incorrect"

 $.ajax({
       type:'post,
       url:'fetchEmployeeProject',
       data:{id:4},
       success:function(data){
           $('#mypagination').twbsPagination({
              totalPages: data, //error if data is zero.
              visiblePages: 7,
              onPageClick: function (event, page) {

                  $('#divcontainer').load('load_data.php',{id:4});

              }
          });

       }

   });
eugenesimakin commented 9 years ago

Hi ezekel,

look at lines from 22 to 35. Here is checked init options. Plugin not supported zero totalPages and negative startPage.

If you need to hide pagination snippet when totalPages <= 0, do it from outside the plugin.