aspose file tools*
The moose likes JSF and the fly likes Pagination with MyFaces (JSF Newbie) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Pagination with MyFaces (JSF Newbie)" Watch "Pagination with MyFaces (JSF Newbie)" New topic
Author

Pagination with MyFaces (JSF Newbie)

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi,

I am using MyFaces (JSF 2.0) and I want to paginate through a dataTable. I have the following code..



Now with the rows attribute I was able to limit the data to 10 per page, but the more challanging question is how do I actually paginate. How do I make the next and previous buttons to appear and how to make them work?

Thanks in advance for any help.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

MyFaces Tomahwak has a pagination control that can be attached to a dataTable.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi Tim,

Thanks for pointing me in this direction. I believe the dataScroller tag is what you are talking about. I included it in my page with the code below...



But when I run it still nothing is showing up. When I look at the HTML source of my rendered page, I see that the tag is not being interpreted (meaning it is appearing as t:dataScroller even in the browser source). Do I need to add any additional configuration files to my WEB-INF make this work, so far all I added was the tomhawk namespace to my xhtml page ...

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16068
    
  21

The main thing is to make sure that the tomahawk jar is included in WEB-INF/lib.

One quirk that the Tomahawk datascroller had was that it only worked when placed under the dataTable on the page. I haven't used it in a while, however, so I don't know if that limitation still applies or not.
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi Tim,

I added the Tomahawk jar and now the pagination controls for the dataScroller show up. However pagination still does not work. It is failing in some of the Javascript code that it generated...

It looks like the way dataScroller works is by calling a Javascript method that it created called "oamSubmitForm"...



And it passes linkDummyForm as an argument, but nowhere in the page is there any form by that name, so when it comes this line it fails...



Thanks again for your help.
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi Tim,

I figured it out, I tried wrapping both the dataTable and the dataScroller in a form and that worked. So it looks like dataScroller needs to be part of a form to work.

Thanks,
Jehan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pagination with MyFaces (JSF Newbie)