Main Function:

    /**
     * Calculate the new page index when items per page changed
     * 
@param currentPageIndex Current Page Index
     * 
@param currentRowsPerPage Current Rows Per Page
     * 
@param newRowsPerPage New Rows Per Page
     * 
@return New page index.
     
*/
    
private int newPageIndex(int currentPageIndex, int currentRowsPerPage, int newRowsPerPage)
    {
        
int currentTopIndex = (currentPageIndex-1)*currentRowsPerPage+1;
        
int newPageIndex = currentTopIndex%newRowsPerPage > 0 ? 
                (currentTopIndex
/newRowsPerPage)+1:
                currentTopIndex
/newRowsPerPage;
        
return newPageIndex;
    }

 

 

posted on 2009-04-17 13:21  烂人  阅读(221)  评论(0编辑  收藏  举报