Hi Karl,

Thanks, that did help in getting the links to work correctly.

However, the new code (with slice) isn't working for displaying only
10 rows per page.
I'm using the downloaded page and tables.js code (with the slice
modifications) from the Learning jQuery website, not my own code.

On page 1, all rows are shown, on the page 2, rows 20 through the end
of the list display, on page 3, rows 30 through the end of the list
display, you get the idea.

Any thoughts?


On Dec 29, 1:37 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> Sorry about the confusion with the API change. If you're replacing
> the .lt() method, you're going to need to use 2 arguments with
> the .slice() method, with the first argument being 0.
>
> So, try .slice(0, currentPage * numPerPage) instead.
>
> That will select the elements with an index between 0 and the value of
> currentPage* numPerPage
>
> Same goes with the other slice:
>
>        .slice(0, (currentPage + 1) * numPerPage - 1)
>
> Hope that helps.
>
> --Karl
> _________________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Dec 28, 2007, at 10:30 PM, rodeopro wrote:
>
>
>
> > I'm working my way through chapter 7 of the Learning jQuery book, and
> > encountered issues with .lt and .gt. After discovering that .lt
> > and .gt had been deprecated in the current release of jquery, I
> > replaced the sample code with the slice method.
>
> > However, I have had no luck getting:
>
> > 1. the page to display only 10 rows of a table on each page
> > 2. getting more than one page to display (none of the links for pages
> > 1-7 work)
>
> > Has anyone worked their way through the table sorting/pagination code
> > in chapter 7?
> > Here's the code I used, which is not working:
>
> > var repaginate = function () {
> >    $table.find('tbody tr').show()
> >       .slice(currentPage * numPerPage)
> >          .hide()
> >       .end()
> >       .slice((currentPage + 1) * numPerPage - 1)
> >           .hide()
> >    .end();
> > };

Reply via email to