Add an action listener to your scroll buttons.
In this action listener get the data table component (use findComponent of the viewRoot). The dataTable has all the (public) properties you need:
- getRowCount() returns the total number of rows
- getRows() returns number of rows per page
- getFirst() returns the index of the current top row
With some division and modulo it is easy to calculate the current page number: see getPageIndex method in HtmlDataScrollerRenderer.
Manfred
Catalin Kormos wrote:
--- "Korhonen, Kalle" <[EMAIL PROTECTED]> wrote:
-----Original Message-----
From: Catalin Kormos [mailto:[EMAIL PROTECTED] Subject: pageSelectionListener tag implementation
help needed
I have to tell that i'm very frustrated that there
is no way
to find out the page selection change on a
dataTable that
displays rows on more than one page. Please correct me if i'm wrong.
Bind your dataScroller pageIndexVar to a property in your own bean, i.e. on the .jsp page: <x:dataScroller .... pageIndexVar="#{myTableBean.pageIndex}" </x:dataScroller>
And in your pageIndex's setter do whatever you needed to do when the page changes, e.g.
Public void setPageIndex(Integer pageIndex) {
if (pageIndex == null) return; if (!pageIndex.equals(this.pageIndex))
pageChanged();
this.pageIndex = pageIndex;
}
Would that work?
No, it does't work. The pageIndexVar represents only a
name used by a bean which holds the page index value,
that can be used inside the dataScroller tag; (like
the var for dataTable). So, binding it like you said,
only changes the name of that bean...(the bean's name
which holds the actual value). Thanks anyway for your
interest.
Any other ideeas?
__________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com

