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:[EMAIL PROTECTED]

Reply via email to