Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem With Pagination

 
A.S. HariLal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Dear Friends,
I did my pagination with the help of pager tag lib. It's working well.
But I noticed that it fetch all the data's from table for each iteration.( Iteration means when I select Next or Previous link)But it display the data's based on the offset. I hope It's not good method. If I have a database containing 1000 items and for each iteration , If it takes all the data's .....the syutem will go wrong.....so I hope there will be an alternative method or a solution to solve it.....so if any one experience such like problems and solve it.....kindly help me......
Regards,ashl
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are more advanced things you can do with the pager tablib, but with a basic implementation your action will load all the records from the database and the taglib will "throw away" all the records except the ones needed for the current page. This seems very wasteful, but I have found this to be acceptable in most cases. One simple optimization is to store the results on the session so you don't have to query the database each time. This solution does not work well for very large datasets or sites with lots of users.

- Brent
 
xu yuanzhi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will calculate which records to be displayed in page with page number,order(desc or asc) and how many records is displayed in one page. As said above, it may be wastful
 
A.S. HariLal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you For the answers........
-ashl
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"ASHL",
Please check your private messages before posting to the ranch again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic