-
1. Re: Problem building rich data table dynamically
yasudevil Jan 18, 2010 9:45 PM (in response to brenkeys)I don't know if the way i'm describing here is the only way, but it's preety plain.
The buildTable method should return a Collection like this
public List<YourObject> buildTable(){ }
Then in your rich dataTable you change the binding property to value. And add the var property wich is the one that will receive the iterate value
<rich:dataTable id="table" value="#{tableCreator.dataTable}" var="entry" rows="10" ></rich:dataTable>
Than you populate your table using something like.
<rich:column> #{entry.name} </rich:column>
-
2. Re: Problem building rich data table dynamically
brenkeys Jan 18, 2010 10:56 PM (in response to brenkeys)Hi, my problem is that i need to build the data table dynamically, i never know if i'm going to have 1,10 or 100 columns, and what are these columns going to contain for example a textBox or a combo. Do you have an idea how to build it completely dynamic?? Thank U :)
By the way, i fixed something in the code because it's not necessary that the method buildTable returns a HtmlDataTable:
import org.richfaces.component.html.HtmlDataTable; @Name("tableCreator") @Scope(ScopeType.SESSION) public class DataTableCreator(){ public HtmlDataTable dataTable; /**Method that build the data table */ public void buildTable(){ //Code here to create data Table (is already working...) } //getters and setters for dataTable }
-
3. Re: Problem building rich data table dynamically
brenkeys Jan 20, 2010 1:58 AM (in response to brenkeys)Any ideas?? Come on guys!!! ;) I'm still trying to resolve this...
-
4. Re: Problem building rich data table dynamically
tonatiuh Apr 13, 2010 1:55 AM (in response to brenkeys)You need add the DataTable to panel
See:
<rich:panel id="panelModulos" binding="#{tableCreator.panelTable}"> </rich:panel>
And:
|"~import org.richfaces.component.html.HtmlDataTable; @Name("tableCreator") @Scope(ScopeType.SESSION) public class DataTableCreator(){ public HtmlDataTable dataTable; public HtmlPanel panelTable () { HtmlPanel panel = new HtmlPanel (); panel.getChildren().add (buildTable()); return panel; } /**Method that build the data table */ public HtmlDataTable buildTable(){ //Code here to create data Table (is already working...) } //getters and setters for dataTable }~"|