Extended Data Table render issue
spring.liao Nov 26, 2011 2:51 AMHi,
In the richfaces 4.1.0.20111111-CR1 when I modified Java Collection on server side, the EDT seems not display correctly to reflect the modification.
But if I rollback to 4.1.0.20111101-M4, it has no problem. Any idea ?
here is the sample code :
------------------------------------------------------
xhmtl:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:head/>
<h:body>
<h:form>
<rich:extendedDataTable id="delete" value="#{edtBean.deletes}" var="d" selectionMode="none">
<rich:column sortBy="#{d}" sortOrder="ascending">
<f:facet name="header"><h:outputText value="Delete"/></f:facet>
<a4j:commandLink action="#{edtBean.del(d)}" execute="@this" render="delete,insert">
<h:outputText value="#{d}"/>
</a4j:commandLink>
</rich:column>
</rich:extendedDataTable>
<rich:extendedDataTable id="insert" value="#{edtBean.inserts}" var="i" selectionMode="none">
<rich:column sortBy="#{i}" sortOrder="ascending">
<f:facet name="header"><h:outputText value="Insert"/></f:facet>
<a4j:commandLink action="#{edtBean.add(i)}" execute="@this" render="delete,insert">
<h:outputText value="#{i}"/>
</a4j:commandLink>
</rich:column>
</rich:extendedDataTable>
<a4j:commandButton value="Exit" action="#{edtBean.exit}" execute="@this" render="@none"/>
</h:form>
</h:body>
</html>
------------------------------------------------------
CDI bean :
package com.spring.billing.app.test;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named;
@Named
@ConversationScoped
public class EdtBean implements Serializable {
@Inject
private Conversation cnv;
private Collection<String> deletes = new ArrayList<String>(Arrays.asList("1", "2", "3"));
private Collection<String> inserts = new ArrayList<String>(Arrays.asList("4", "5", "6"));
public EdtBean() {
System.out.println("EdtBean created");
}
public void add(String s) {
deletes.add(s);
inserts.remove(s);
}
public void del(String s) {
deletes.remove(s);
inserts.add(s);
}
public Collection<String> getDeletes() {
return deletes;
}
public void setDeletes(Collection<String> deletes) {
this.deletes = deletes;
}
public Collection<String> getInserts() {
return inserts;
}
public void setInserts(Collection<String> inserts) {
this.inserts = inserts;
}
public String exit() {
if (!cnv.isTransient()) cnv.end();
return "home";
}
------------------------------------------------------