aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Pagination Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Pagination" Watch "Pagination" New topic
Author

Pagination

Venkata Kiran
Ranch Hand

Joined: Sep 06, 2005
Posts: 30
Hello Everybody,
I am very new to javascript could any one help me out. I am retrieving data from data base and displaying data in 15 columns and i also sorted those records in javascript but now i need to do the pagination
to display 20 records in each page and i have to use JavaScript. Can any one help me out, by sending one example on this type of Pagination
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
"Raj80",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

Thanks,
Eric Pascarello
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You have to use JavaScript? Sounds strange to me. Where is the paging happening? Does it have all of the records at once or does it have to hit the server?

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

In the browser (using Javascript) is entirely the wrong place to doing this sort of thing.
[ February 06, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
steveo austin
Greenhorn

Joined: Feb 02, 2006
Posts: 5
I agree with Bear Bibeault
, I have implemented pagination in a module at the DB level ... heres a snapshot . I am using DB2.

WITH TEMP (ROWNUM,DIM_VAL_CD, IS_ACTIVE_IND,SEQUENCE_NBR)as
(SELECT ROW_NUMBER() OVER(ORDER BY IS_ACTIVE_IND ,SEQUENCE_NBR ,UPPER(DIM_VAL_CD) ) ROWNUM,
DIM_VAL_CD,IS_ACTIVE_IND,SEQUENCE_NBR FROM
DIMENSIONVALUE WHERE DIM_TYPE_ID = ? ORDER BY IS_ACTIVE_IND ,SEQUENCE_NBR,UPPER(DIM_VAL_CD))
SELECT (SELECT MAX(ROWNUM) FROM TEMP ) TOTALROWS,
DIM_VAL_CD,IS_ACTIVE_IND,IS_APPROVED_IND FROM TEMP WHERE ROWNUM >? AND ROWNUM <=?
[ February 06, 2006: Message edited by: steveo austin ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

For non-DB2 databases, the syntac will be different. PostgreSQL, for example, employs the OFFSET and LIMIT keywords.
Venkata Kiran
Ranch Hand

Joined: Sep 06, 2005
Posts: 30
Hi Everyone,
Sorry for my late response. Let me explain what exactly i am doing.
I have nearly 100 records in my database and i am using JavaScript(client side)to sort these 100 records. Sorting is working fine but now i need to display these sorted records as 20 records per page
(for Ex |< < 1 2 3 4 .. > >|) i hope these explains the problem.
[ February 10, 2006: Message edited by: Gururaj ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

"Gururaj", you have already been asked in this very topic to adjust your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are closed.

bear
JavaRanch Sheriff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagination