botmonster / jquery-bootpag

BootPag - boostrap dynamic pagination jQuery plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'next' and 'prev' skip a page when using href-option

gvanderploeg opened this issue · comments

When clicking the next- or prev-button combined with the use of the custom href-option, the {{number}} in the href will skip a page.
When beginning on page 1, clicking on 'next' will have these effects:

  • page 2 in the pager is highlighted as the current (expected)
  • but the browser URL will have changed to #page-3 (or ?page=3, whatever actual href-option was configured) (unexpected)

Same goes for the 'prev' button.

Example with debug logging in JS Fiddle: http://jsfiddle.net/SuUZ6/

I am stuck on this issue as well. Does anyone have a work around or a fix? Thanks!

We worked around it by using the 'page' event instead of the href-option.
In the page-event we just set window.location using the 'num' parameter (which is correct there and does not skip a page)

Thanks for the tip! I did find how to fix the javascript, but I'm not sure if it might break something else. So far it is working well.

me.find('li').click(function paginationClick(){
var me = $(this);
if(me.hasClass('disabled')){
return;
}
var page = parseInt(me.attr('data-lp'), 10);
/////renderPage($bootpag, page); /* was causing the skip */
$owner.trigger('page', page);
});

should work fine since 1.0.6

...still had this issue with 1.0.7. Thanks to @gvanderploeg, your idea helped us a lot!

I'm also having the same issue, with 1.0.7...

I'm also having this issue with 1.0.7. Thanks for the suggestion @gvanderploeg.

I am also facing the same issue on 1.0.7

Hi @gvanderploeg , Can you please let me know the fix you did for the above issue

@chaitu234kin , it's more than 5 years ago... I don't know by heart anymore. But according to my comment above, that workaround did it for me.