• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

pagination with tomahawks dataScroller

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howzit everyone,

Hopefully someone can help me here. Below is the code for a jsp and bean. Just a simple example trying to demonstrate how to use the dataScoller to help with pagination over a dataTable.

The problem is that when I run this code, and go to the page, first time the page displays correctly. When I click search all is still fine. If I click search again, all still remains fine. However, When I navigate to a page that is greater than my NEXT searches result that is when this thing starts going haywire.

So in other words, using this example, navigate to this page. You should see 1 result. Then click on search. You should now see 3 pages, with 5 results. Click on page 2 or 3 using the dataScroller. Then click search again, which should take you back to only 1 search result and check what happens. No error messages, or anything, just the dataScoller looks like it isn't reset, to show page 1, and is showing page 2 or 3, but these have no results.

Am I missing something here, or is this a bug in the dataScoller?

Cheers
Darryl

THE JSP PAGE:.
=====================



THE BEAN:.
=====================
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all your code does not show that search() is returning any String. I assume that this is not your actual code...
I faced same problem and here are the precautions that I took to fix it:
1. The search call from the commandButton has to go to an action and not actionListener.
2. The search method in the backing bean should not return a "". Instead it should return a String that is set in the navigation rules in your faces-config file(in this case it will be navigated to the same jsp).
3. The backing bean has to be in session scope.

Also I noticed that your datatable implementation and datascroller implementation are not same(h:datatable/t:datascroller). I do not have this kind of mix up.

Let me know if this helped you.
[ December 02, 2008: Message edited by: A. Dusi ]
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello A,

Thanks for your comments. This is my original code. An action method does not need to return anything, all the happens if you return void, or String == null is that the return back to the page you were on.

Onto the solution. I found a solution to this. Sorry for not posting it earlier, but you know how it goes, work work work.

I don't know if this is a bug in the dataScroller, or if it has been intentionally coded this way, but when you change the underlying List, it does not reset itself. IE go back to page 1. We have to do it ourselves.

The way to do this is to bind the <t:dataScroller to a component on our bean. Create the necessary accessors and mutators for this component


Then in the search method, before each search we need to reset the dataScoller by executing this code, or rather calling a method passing in the value 0 (zero).


That's that. Bob's your uncle, and all that.

HTH
Cheers
Darryl
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic