myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hans Sowa" <hanss...@gmail.com>
Subject Re: missing row attribute in a datatable using a datascroller causes by zero exception
Date Tue, 28 Mar 2006 09:58:56 GMT
Ah, super, thanks a lot. This is really helpfull.

2006/3/28, Mike Kienenberger <mkienenb@gmail.com>:
>
> Fixed as of March 1st.
>
> http://issues.apache.org/jira/browse/TOMAHAWK-104
>
> On 3/27/06, Hans Sowa <hanssowa@gmail.com> wrote:
> > Hi
> >
> > Is there a possibility to enhance the code of this method? My Problem is
> if
> > there the row attribute is missing in the datatable (using datascroller)
> you
> > will always get an "by zero" exception because of the line "if (
> > uiData.getFirst() % rows > 0)". It would be very helpfull to have a more
> > specific Exception.
> >
> > Many thanks in advance.
> >
> > class: HtmlDataScroller
> > /**
> >      * @return the page index of the uidata
> >      */
> >     public int getPageIndex()
> >     {
> >         UIData uiData = getUIData();
> >         int rows = uiData.getRows();
> >         int pageIndex;
> >         if (rows > 0)
> >         {
> >             pageIndex = uiData.getFirst () / rows + 1;
> >         }
> >         else
> >         {
> >             log.warn("DataTable " +
> > uiData.getClientId(FacesContext.getCurrentInstance())
> >                             + " has invalid rows attribute.");
> >             pageIndex = 0;
> >         }
> >         if (uiData.getFirst() % rows > 0)
> >         {
> >             pageIndex++;
> >         }
> >         return pageIndex;
> >     }
> >
> >
> > --
> > mfg Hans Sowa
> > mailto:hanssowa@gmail.com
>



--
mfg Hans Sowa
mailto:hanssowa@gmail.com

Mime
View raw message