A
A
Alena2017-01-09 21:13:57
Java
Alena, 2017-01-09 21:13:57

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);
        }
         
    }

But instead of a table, there is an empty (blank) sheet.
What could be the problem, tell me, please!!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alena, 2017-01-21
@SAlenaA

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

S
Stanislav Zemlyakov, 2017-01-20
@redtom

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 question

Ask a Question

731 491 924 answers to any question