Mike,
I was able to get the paging control to work fairly easily (much easier than
the column sort which took a few days) - here's my code that I leveraged
from the examples:
<h:panelGrid columns="1" styleClass="scrollerTable2"
columnClasses="standardTable_ColumnCentered">
<t:dataScroller id="scroll_1" for="data" fastStep="10"
pageCountVar="pagecount" pageIndexVar="pageindex" paginatorMaxPages="9"
paginator="true" paginatorActiveColumnStyle="font-weight:bold;"
rendered="#{searchproviders_bean.dm_searchresults.rowCount > 10}">
<f:facet name="previous">
<t:graphicImage url="images/arrow-previous.gif" border="1" />
</f:facet>
<f:facet name="next">
<t:graphicImage url="images/arrow-next.gif" border="1" />
</f:facet>
</t:dataScroller>
<t:dataScroller id="scroll_2" for="data" rowsCountVar="rowsCount"
displayedRowsCountVar="displayedRowsCountVar"
firstRowIndexVar="firstRowIndex" lastRowIndexVar="lastRowIndex"
pageCountVar="pageCount" pageIndexVar="pageIndex">
<h:outputFormat value="#{example_messages['dataScroller_pages']}"
styleClass="standard">
<f:param value="#{rowsCount}" />
<f:param value="#{displayedRowsCountVar}" />
<f:param value="#{firstRowIndex}" />
<f:param value="#{lastRowIndex}" />
<f:param value="#{pageIndex}" />
<f:param value="#{pageCount}" />
</h:outputFormat>
</t:dataScroller>
</h:panelGrid>
The output format message bundle can be found in the
example_messages.properties found in the myfaces examples:
dataScroller_pages = {0} Cars found, displaying {1} cars, from {2} to {3}.
Page {4} / {5}
Note the <t:dataTable id="data"..> needs to match the <t:dataScroller
for="data"...>
Also note, I've added the "rendered" attribute for the first datascroller:
rendered="#{searchproviders_bean.dm_searchresults.rowCount > 10}"
The purpose for using rendered is to not display the paging controls if
there is not enough data to page (in my case < 10 rows.)
I am only able to get rendered to work if I use a DataModel (which has a
rowCount attribute) as the data source. I tried to use the MyFaces
#{rowsCount} var without success (maybe someone knows how to do this.
Finally, I'm going to try to extend this so that the 'previous' page control
does not display if the user is on the first page of data, and so that the
'next' page control does not display if the user is on the last page of data
(similar to how google search results work), though I have not found a way
to do this yet? Any Ideas from anyone on this?
Thanks
Tom
-----Original Message-----
From: Mike [mailto:[EMAIL PROTECTED]
Sent: Sunday, January 01, 2006 8:59 AM
To: MyFaces Discussion
Subject: Paging Control
Hi all,
Is there anything special (any "gotchas") to watch out for with the
paging control or is it relatively straightforward to get working?
Thanks.
Mike