-
1. Re: rendering of outputPanel with dataTable
fekete_kamosh Nov 25, 2011 9:24 AM (in response to blebleskeble)1 of 1 people found this helpfulHi,
I think that there might be problem with components in RichFaces. But as a workaround try not to create new instance in randomizeContent() method. Instead clear items and refill them.
private void randomizeContent() { Random r = new Random(System.currentTimeMillis()); int num = (r.nextInt(20)); name = "Size " + num; //items = new ArrayList<String>(); items.clear(); for (int i = 0; i < num; i++) { items.add("Item" + (i + 1)); } }
There would be problem that some component holds reference to list but you create the new one.
Fekete
PS: I think your example is not so big. Lets expose its code to attract more RichFaces guys
-
2. Re: rendering of outputPanel with dataTable
blebleskeble Nov 25, 2011 9:31 AM (in response to fekete_kamosh)ok, so here are codes:
DummyBean.java
import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Random; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.event.ActionEvent; @SuppressWarnings("serial") @ManagedBean(name = "mb") @ViewScoped public class DummyBean implements Serializable{ private String name; private List<String> items; public DummyBean() { name = ""; items = new ArrayList<String>(); randomizeContent(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<String> getItems() { return items; } public void setItems(List<String> items) { this.items = items; } public void action(ActionEvent event) { randomizeContent(); } private void randomizeContent() { Random r = new Random(System.currentTimeMillis()); int num = (r.nextInt(20)); name = "Size " + num; items = new ArrayList<String>(); for (int i = 0; i < num; i++) { items.add("Item" + (i + 1)); } } }
index.xhtml
<!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:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <h:head> </h:head> <h:body> <h:form id="myForm"> <a4j:commandLink id="link" value="Change" actionListener="#{mb.action}" render="panel" /> <br /> <a4j:commandLink id="refressh" value="Refresh" render="panel" /> <br /> <a4j:outputPanel id="panel" layout="block"> <h:outputText value="#{mb.name}" /> <rich:dataTable id="table" value="#{mb.items}" var="item"> <rich:column> <h:outputText value="#{item}" /> </rich:column> </rich:dataTable> </a4j:outputPanel> </h:form> </h:body> </html>
-
3. Re: rendering of outputPanel with dataTable
blebleskeble Nov 25, 2011 9:51 AM (in response to fekete_kamosh)Fekete Kamosh wrote:
Hi,
I think that there might be problem with components in RichFaces. But as a workaround try not to create new instance in randomizeContent() method. Instead clear items and refill them.
private void randomizeContent() { Random r = new Random(System.currentTimeMillis()); int num = (r.nextInt(20)); name = "Size " + num; //items = new ArrayList<String>(); items.clear(); for (int i = 0; i < num; i++) { items.add("Item" + (i + 1)); } }
There would be problem that some component holds reference to list but you create the new one.
Fekete
PS: I think your example is not so big. Lets expose its code to attract more RichFaces guys
Yes, this solves my problem, thanks much.
-
4. Re: rendering of outputPanel with dataTable
blebleskeble Nov 28, 2011 2:24 AM (in response to blebleskeble)Same problem occurs with collapsibleSubTable, but with my solution I'm not able to hold reference to its data object.
-
5. Re: rendering of outputPanel with dataTable
blebleskeble Dec 8, 2011 3:48 AM (in response to blebleskeble)Solved in RF 4.1 CR2