Answer the question
In order to leave comments, you need to log in
Why is nothing displayed?
hello,
I want to display a dynamic table on the page. Here is the part:
<div id="list" >
<h:form>
<p:dataTable var="directory" value="#{dataDB.tableCity}" style="margin-bottom:20px">
<p:columns headerText="#{dataDB.columns}" var="column"
columnIndexVar="colIndex" sortBy="#{directory[column]}" filterBy="#{directory[column]}">
<f:facet name="header">
<h:outputText value="#{column}" />
</f:facet>
<h:outputText value="#{directory[column].value}" />
</p:columns>
</p:dataTable>
</h:form>
</div>
public void buttonAction() {
try {
tableCity=ConnectToDB.getData("*", "city").data;
columns=ConnectToDB.getData("*", "city").name;
cnt=columns.size();
System.out.println(tableCity);
System.out.println(columns);
System.out.println(cnt);
} catch (Exception ex) {
Logger.getLogger(dataDB.class.getName()).log(Level.SEVERE, null, ex);
}
}
Answer the question
In order to leave comments, you need to log in
I solved this problem with c: foreach, for some reason if p: column + c: foreach then everything is displayed, if p: columns is completely ignored
How is your buttonAction() method called? Unclear. How is the table initialized? If by clicking on the button, then there seems to be a listener there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question