Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pagination

 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the browser (using Javascript) is entirely the wrong place to doing this sort of thing.
[ February 06, 2006: Message edited by: Bear Bibeault ]
 
steveo austin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For non-DB2 databases, the syntac will be different. PostgreSQL, for example, employs the OFFSET and LIMIT keywords.
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic