Wednesday, December 28, 2011

Async Paging Plug-in by Javascript

In our project, I created a  web control to handle paging on server side. In server side code, data is retrieved from a datasource (it might be database) then generate valid HTML output and write into a web page. But what if you need to call  server side code asynchronously to retrieve data by javascript. You have to deal with paging by using client side code which is javascript.

After that, I decided to create nice and easy use client-side HTML control to manage paging by only pure javascript without jQuery. This doesn't mean I don't like jQuery. I'm using it a lot. But for this plug-in jQuery is not needed.

When you use Aysnc Paging control you'll see that data type is not important. It might be JSON, XML or simple Array.


First and foremost I thought implementing Async Paging plug-in and modifying its layout must be easy for developers. The only thing you have to do is initializing some values such as records count, an HTML element id where you want to generate and display it. As follows, you can find the code excerpt about how to initialize Async Paging Plug-in.

asyncPaging.init("paging", // element id where paging is drawn
data.length, // total record
10, // represents how many items are displayed in each list
1); // current page number


For Demo
For Implementation

0 comments: