Java
  Home arrow Java arrow Page 2 - Building a Pagination System with AJAX
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Building a Pagination System with AJAX
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 83
    2006-06-05

    Table of Contents:
  • Building a Pagination System with AJAX
  • Building the dynamic scroll bar
  • Defining the scrolling system’s CSS declarations
  • Defining the (X)HTML markup and JavaScript functions

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building a Pagination System with AJAX - Building the dynamic scroll bar


    (Page 2 of 4 )

    In order to start building up the AJAX-driven scrolling system, first I must create the dynamic scrollbar. It will be the key element that commands the whole application, instructing when to fetch new records from the corresponding database table and displaying chunks of rows.

    In short, I’m not going to utilize a real scrollbar, like the one displayed on certain (X)HTML elements, but I’ll create a fake one, comprised basically of two DIVS. The first DIV will be the element responsible for displaying the background of the scrollbar, in conjunction with the corresponding scrolling arrows, while the second one will show the proper handle. As you might have guessed, the position of this handle along the scrollbar will control how and when to fetch new packets of database records.

    Since the previous description will be best understood with some images, take a look at the pictures below. They show the background images that I’m going to use for each DIV element of the dynamic scrollbar, along with a screenshot of the application in action:

         

     

    As you can see, the first two images depicted above show clearly how the dynamic scrollbar will be constructed, while the last one exemplifies how the application will display different sets of database records. Regarding the creation of the dynamic control bar, the first DIV element will hold the handle, while the second one will be used for displaying the complete scrollbar.

    Obviously, these two elements properly overlapped will simulate a real (X)HTML scrollbar. In this specific case, the handle can be programmatically controlled via JavaScript to trigger HTTP requests in the background, in accordance with its physical position within the containing scrollbar.

    However, there’s still one question that remains unanswered: how will the above handle be turned into a “sliding” element, in this way simulating a real scrollbar element? Well, to achieve this, I’ll use the help of a good JavaScript library, in order to make the DIV that contains the handle a “drag-and-drop” control. But in fact, I’m getting ahead of myself, so let’s continue for the moment exploring other topics.

    All right, now that you know how the dynamic scrollbar will be created, the next step rests on defining the corresponding CSS rules, along with the (X)HTML markup that will make up the user interface of this AJAX-driven scrolling system.

    With reference to building the graphical interface, over the course of the next section, my attention will be focused on defining the pertinent CSS styles that control the visual presentation of the application, therefore wait no longer and read the next few lines.

    More Java Articles
    More By Alejandro Gervasio


       · If you're one of those developers wanting to use AJAX in creative ways, then this...
       · One thing that would make this even better is to size the drag handle based upon the...
       · Thank you for commenting on this article. Yeap, definitively, the improvement you...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT