setPropertyActionListener not being invoked after 2nd page ...
kjo2x Apr 1, 2010 5:49 PMHi,
I've tried this with richfaces 3.3.2 and 3.3.3 version running on jboss4.2.2GA -- I have a dataTable with a commandLink attached to one of the columns. When the user clicks on one of the links, I want to get the row object. So I used the setPropertyActionListener to capture the selected object. I then use this selected object to display data in a modal panel. When I render the page, it works fine for the first page in the dataTable. When I click on the dataScroller to move to the next page, when I click on one of the links from the row, it doesn't give me the current selected row/object. Since my backing bean is stored in the session, it is displaying what I selected last. If I go back to the first page, it works fine. I put a trace in the set method in my backing bean and noticed that it is only called on the first page, but any subsequent pages, it doesn't get called. Here is how my .xhtml file looks like:
<body>
<f:view>
<a4j:outputPanel>
<h:form>
<rich:dataTable id="data"
styleClass="scrollerTable"
headerClass="standardTable_Header"
footerClass="standardTable_Header"
rowClasses="standardTable_Row1,standardTable_Row2"
var="car"
value="#{scrollerList.list}"
preserveDataModel="false"
rows="10">
<h:column>
<h:outputText value="#{car.id}" />
</h:column>
<h:column>
<h:outputText value="#{car.type}" />
</h:column>
<h:column>
<h:outputText value="#{car.color}" />
</h:column>
<h:column>
<a4j:commandLink reRender="data" value="Hello">
<f:setPropertyActionListener value="#{car}" target="#{scrollerList.selectedCar}"/>
</a4j:commandLink>
</h:column>
<f:facet name="footer">
<rich:datascroller id="paginator"
ajaxSingle="false"
for="data"
maxPages="10"
page="#{scrollerList.pageNumber}"></rich:datascroller>
</f:facet>
</rich:dataTable>
</h:form>
</a4j:outputPanel>
</f:view>
</body>
</html>
My backing bean has these methods:
public SimpleCar getSelectedCar() {
return mSelectedCar;
}
public void setSelectedCar(SimpleCar pSelectedCar) {
System.out.println("Selected car is : " + pSelectedCar.getId());
this.mSelectedCar = pSelectedCar;
}
I saw this thread http://community.jboss.org/message/50601#50601 but the solution to have a member instead of a method to set the selected row doesn't work. I get an error when it tries to call the setter method in my bean.
Any suggest is greatly appreciated.
Thanks