agent2026 a écrit :
> This undocumented plugin is really worth adding to the repository I
> think.  It needs a little fleshing out, which I've tried to do, but
> all in all is a super fast, super easy to implement pager.
>
> I've modified it with spread (how many pages to either side of your
> current page will show in the navigation) and nonNumerical arguments
> (whether to show page numbers or not) to make it a bit more versatile.
>
> I've come across one problem though, which I hope someone can figure
> out.  If the number if line items per page (step) is divisible equally
> into the total number of line items, I end up with a 'phantom' empty
> page at the end.  For example, if my line item limit is set to 10
> ( ul.pager(10) ), and I have 30 line items in total, the pager will
> produce 4 pages instead of 3 with the 4th page being empty
> (nonNumerical setting makes no difference).  I could hack it away of
> course, but I 'd really like to know why this happens.  The bug is
> present in the original too, http://jquery.com/api/js/pager.js.
>
> As far as I can see there's no way to upload files in Ggroups, so it's
> all below.
>
> Adam

To correct the phantom page, you only have to delete a substract
sign :

      if (rows.length > step)
        for ( var i = 0; i <= rows.length; i += step ) {
          names.push( names.length + 1 );
          num.push( [ i, step ] );
        }

become

      if (rows.length > step)
        for ( var i = 0; i < rows.length; i += step ) {
          names.push( names.length + 1 );
          num.push( [ i, step ] );
        }

it works for me ... Hope that's all needed ...

Tcho
__
Romain

Reply via email to