:) thanks, now it's clearer. I'll give it a try,
implementing the needed tags also, i just need to do
some more research about how events are handlet with
JSF...if everything goes fine, i guess it won't be a
problem if i modify the default rendered of the
dataScroller, which is "HtmlDataScrollerRenderer", so
that the listener tag will be available not just for
my renderer, and submit my work. Hope i will make it i
time, because i realy need it.

Regards,

Catalin

--- Manfred Geiler <[EMAIL PROTECTED]> wrote:

> Catalin,
> Yes, of course. Sorry, for misleading you. My fault.
> I simply forgot that the button and paginator links
> are not rendered my 
> you, but by the datascroller directly. So, you
> cannot add an action 
> listener, of course.
> Well, I hope this should work:
> Sub-class the HtmlDataScrollerRenderer, call it 
> MyHtmlDataScrollerRenderer and register it as the
> default renderer for 
> datascroller:
> <renderer>
>
<component-family>javax.faces.Panel</component-family>
>
<renderer-type>org.apache.myfaces.DataScroller</renderer-type>
>
<renderer-class>ro.citrusmedia.lims.web.ui.util.MyHtmlDataScrollerRenderer</renderer-class>
> </renderer>
> 
> Now in your MyHtmlDataScrollerRenderer overwrite the
> decode method:
> public void decode(FacesContext context, UIComponent
> component)
> {
>    super.decode(context, component);
>    UIData uiData =
> findUIData((HtmlDataScroller)component, component);
>    //Now use the getRows, getRowIndex methods to
> find out the current
>    //page and do some action...
> }
> 
> I hope this works, I have not tried it.
> Of course, this would also be the place where one
> would queue a 
> <hint>not yet existing</hint> PageSelectionEvent
> that later gets 
> broadcasted to a <hint>also not yet existing</hint> 
> PageSelectionListener, as you suggested.  ;-)
> 
> Manfred
> 
> 
> 
> Catalin Kormos wrote:
> > Hi Manfred, thanks for your reply,
> > 
> > I'm afraid that i don't realy understand; adding
> an
> > action listener to my scroll buttons, what this
> means
> > exactly? i tryied using <f:actionListener>...like
> > this:
> > 
> > <f:facet name="first" >
> >                                                             <h:graphicImage
> > url="../images/datascroller/arrow-first.jpg"
> > border="0" />
> >                                                             
> > <f:actionListener
> >
>
type="ro.citrusmedia.lims.web.ui.util.WebTableModel"/>
> >                                                         </f:facet>
> > but it trows the following exception:
> > org.apache.jasper.JasperException: Component _id53
> is
> > no ActionSource
> > 
> > And what about the page indexes? the user can jump
> to
> > a specific page using also the links to each page
> > (1,2,3,...n), not just the navigation buttons.
> > 
> > When using the viewRoot's findComponent, i have to
> > know the name (id) of the dataTable...which i
> don't
> > (from my backend bean).
> > 
> > --- Manfred Geiler <[EMAIL PROTECTED]> wrote:
> > 
> > 
> >>Catalin,
> >>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 
> >>> 
> >>>
> >>>
> >>>
> >>
> > 
> > 
> > 
> >             
> > __________________________________ 
> > Do you Yahoo!? 
> > All your favorites on one personal page � Try My
> Yahoo!
> > http://my.yahoo.com 
> > 
> > 
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to