myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anders H. Andersen" <anders.h.ander...@jyskebank.dk>
Subject t:datascroller cannot get past page 2
Date Tue, 25 Mar 2008 13:09:15 GMT
I have a datatable where the user can change the number of rows from
dropdownlist. The datatable should go back to page 1 when the number of
rows is changed. 

I am using the description on this page:
http://wiki.apache.org/myfaces/ManagingDataScrollerPage to control the
number of rows in the table and set the row index. I have a
valueChangeListener on the dropdownlist that sets the row index to zero.

The problem is that the datascroller will not scroll past page 2. The
rowindex is only incrementet from page 1 to page 2. Can annyone see
whats wrong?

The datatable looks like this:

<t:dataTable id="betalinger"
	value="#{betalingBB.alleUIBetalinger}" var="betalingUI"
	rendered="#{betalingBB.showBetalinger}"
	sortable="false" 
	rows="#{betalingBB.rowsPerPage}"

	rowIndexVar="rowIndex"
	first="#{betalingBB.rowIndex}">

Backing bean methods: 

	public void setRowsPerPage(int rowsPerPage) {
		this.rowsPerPage = rowsPerPage;
	}

	public int getRowsPerPage() {
		return this.rowsPerPage; 
	}

	public int getRowIndex() {
		return rowIndex;
	}

	public void setRowIndex(int rowIndex) {
		this.rowIndex = roundDownRowIndex(rowIndex);
		this.rowIndex = rowIndex;
	}

	private int roundDownRowIndex(int rowIndex) {
		int page = rowIndex / getRowsPerPage();
		return page * getRowsPerPage();
		
	}
	
	public void rowsPerPageChanged(ValueChangeEvent value) {
		// go to page 1
		setRowIndex(0);	
	}




Datascroller:

<t:dataScroller for="betalinger"

	pageCountVar="pageCount" pageIndexVar="pageIndex"

	paginator="true" paginatorMaxPages="10" 
	immediate="false"
	renderFacetsIfSinglePage="false"
	paginatorActiveColumnStyle="font-weight:bold;" >
	<f:facet name="first">
		<t:graphicImage url="/images/paging_begin.gif"
border="0" alt=""/>
	</f:facet>
	<f:facet name="last">
		<t:graphicImage url="/images/paging_end.gif" border="0"
alt=""/>
	</f:facet>
	<f:facet name="previous">
		<t:graphicImage url="/images/paging_left.gif" border="0"
alt=""/>
	</f:facet>
	<f:facet name="next">
		<t:graphicImage url="/images/paging_right.gif"
border="0" alt=""/>
	</f:facet>
</t:dataScroller>

regards
Anders H. Andersen
E-Bank

Jyske Bank A/S
Vestergade 8-16
DK-8600 Silkeborg
Telefon +45 8989 2695 (Direkte)
Telefon +45 2048 4493 (Mobil)
anders.h.andersen@jyskebank.dk
CVR-nr. 17 61 66 17
www.jyskebank.dk




Mime
View raw message