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 Swedberg
www.englishrules.com
www.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