Plugins

User login
Can't find a Plugin?

Can't find a Plugin you are looking for? Check out the jQuery Wiki page.

Are you a plugin developer? Please move your plugin over to this site.

Website Bug or Feature Request?

Found a bug on the new jQuery Plugin website? Have a feature request?

Submit it to the jQuery Plugin website issue queue to ensure it is noticed!

Create a default callback handler to handle pagination for local elements


Project:Pagination
Version:1.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

It looks to me like there are 2 main types of callbacks one would want to use with this.

The first is an AJAX callback where one would need to make an AJAX call back to get the new records. This would be highly user intensive and so probably not very easy to set up in a component (do-able, just not that simple).

The other callback one would use is where all the records are already available on the page, but pagination is desired for usability reasons (not necessarily performance ones).

In this case if the user is to input the record list into the pagination plugin, it should be easy to set up a default callback which will automatically paginate through the results.

The code would need to

a) determine the page id clicked (which it already does)
b) multiply that with the number of items per page to get the start of the set
c) add the number of items per page to get the end of the set
d) hide all the items
e) show the ones in the range

Here is some sample code which does just that
var itemsPerPage = 10; // configurable
paginationHandler = function(id, element, items){
var pageStart = id * itemsPerPage;
var pageEnd = pageStart + itemsPerPage;

//first hide all items
items.hide();

// show the ones that are between the page start and end
items.each(function(i){
if (i >= pageStart && i < pageEnd) {
$(this).show();
}
});
}

Basically it would be great if this could be put into the pagination plug in.