botmonster/jquery-bootpag

reset to first page

Repkit opened this issue · 3 comments

Hi,
First of all very nice and useful plugin, congrat!
Anyway I've a problem cause I don't know how can I reset the plugin to first page. I need this because I use pagination together with some filters on the pages, and after one filter is applied I need to move paginator to first page. Physically I've reset the dom elements to show the good page but the issue is that after filter is applied I display first page on the current paginator page.
Basic example: I'm on 3rd page on paginator, I apply one filter which hide/show some

  • in list, I do the backend job to display the right content for the first page but paginator stays at 3rd page.

    Currently as a workaround I've done:

    $('ul.bootpag>li').each(function(){
    if($(this).hasClass('disabled')){
    $(this).removeClass('disabled');
    return false;
    }
    });
    $('ul.bootpag>li').each(function(){
    if($(this).attr('data-lp') == 1){
    $(this).addClass('disabled');
    return false;
    }
    });

  • You can simulate 'click' event to reset to page 1. See example http://jsfiddle.net/botmonster/Q8Ub4/
    I hope this helps.

    Good idea, thank you very much

    This doesn't work if you're on page 11. It just goes back to page 11.

    Is there any way to do this through event triggering or through the API?