Problem with sort column links in rich:dataTable after rerendering
ayven Jun 24, 2010 7:17 AMScenario description:
--------------------------------
I would like to display a 'rich:dataTable' with sorting functionality on a page after clicking on 'a4j:commandButton' (table will be rendered in 'ajax' way).
Here is a snippet of XHTML code (complete '.xhtml' file is included as attachment):
<h:form>
<a4j:commandButton id="cmdButton" value="click" reRender="tablePanel" action="#{legalEntitySearchAction.exampleAction}" />
</h:form>
<a4j:outputPanel id="tablePanel">
<h:form id="tableForm">
<rich:dataTable id="table" value="#{legalEntitySearchAction.exampleList}" var="value" rows="10"
rendered="#{legalEntitySearchAction.exampleList.size > 0}">
<rich:column sortBy="#{value}" width="100px">
<f:facet name="header">
<h:outputText value="value" />
</f:facet>
<h:outputText value="#{value}" />
</rich:column>
</rich:dataTable>
</h:form>
</a4j:outputPanel>
@Stateful
@Name("legalEntitySearchAction")
@Scope(ScopeType.CONVERSATION)
public class LegalEntitySearchActionBean implements LegalEntitySearchAction {
private List<String> exampleList = new ArrayList<String>();
public List<String> getExampleList() {
return exampleList;
}
public void setExampleList(List<String> exampleList) {
this.exampleList = exampleList;
}
public List<String> exampleAction() {
for (int i = 0; i < 10; i++) {
if (i % 2 == 0) {
exampleList.add("abcd");
} else {
exampleList.add("efgh");
}
}
return exampleList;
}
}
Problem:
-----------
After clicking on command button, the table is rendered on the page with correct values, but:
After clicking on sort link in column header, values are not sorted and table is not re-rendered at all (also images - arrows in column header are not changed). I notice that ajax request is sent after clicking on sort link and also response is received, but it does not contain any HTML code with 'table' elements (a4j:log component output is included as attachment). This operation also does not produce any Java Script error or any JSF error messages.
I notice also that if the table is rendered on the page immediately after GET request and then the table is again re-rendered by AJAX request, sort links work fine. The problem appears only if the table is not displayed after first GET request on a page and subsequently rendered by AJAX.
I also tried to re-render only parent form (instead of 'a4j:outputPanel'), but the result is same.
Can someone pls help me with this?
Thanks in advance.
Environment:
------------------
Seam 2.2.0.GA
RichFaces 3.3.3.Final
Facelets 1.1.14
JSF 1.2 (shipped with Weblogic 10.3.2)
Application is deployed on Weblogic 10.3.2 as EAR.
Tested with Firefox 3.6.3 and Chromium 6.0.
-
ajax-table-example.xhtml.zip 739 bytes
-
a4j.log.zip 1.6 KB
-
LegalEntitySearchActionBean.java.zip 549 bytes