I'm currently building an xhtml page based on Primefaces 3.5 (which I can't update...not lucky this time!).
In this page I need to build dynamically different datatables so I thought that unique way to achieve my task is through the binding method.
So I've made:
<p:dataTable id="bindQTable" var="item"
value="#{bindingHtmlTableClass.items}"
binding="#{bindingHtmlTableClass.dataTable}">
<p:column headerText="Name Column">
<h:outputText value="#{item}" />
</p:column>
<p:column>
<p:commandButton value="remove"
action="#{bindingHtmlTableClass.remove}" />
</p:column>
</p:dataTable>
and the bean:
@ManagedBean(name="bindingHtmlTableClass")
@RequestScoped
public class BindingHtmlTableClass implements Serializable{
private List<String> items;
private DataTable dataTable;
@PostConstruct
private void buildUp(){
System.out.println("postconstruct!");
items = new ArrayList<String>();
items.add("X");
items.add("Y");
}
...getters,setters...
}
The problem now is that I would need to update the tables and especially after a poll period I need to update the values within them.
But i'm in a Request Scope and I can't use a View Scope because of binding. Is there a better way to implement such thing?
EDIT 4 BalusC: why i need binding the datatable? Because i need to show a datatable linked to a serie of different connection to different installation of RabbitMQ, which is not a known number. My boss asked me to put each RabbitMQ server in a different DataTable where each queue is represented in a different row. Each column needs to show actual queue size plus a button or more to manage the queue (purging, deleting...).
Thanks!
>`? See also that food link http://stackoverflow.com/q/14911158 Ctrl+F on "dynamic model".