user1285928
user1285928

Reputation: 1476

How to rewrite JSF h:table into h:panelGrid

I need a way to create editable table like this. I interested is it possible to use h:panelGrid to display and edit the data. From my previews post I saw that it's possible to simple JSF table, but is this possible with h:panelGrid?

<table>
    <ui:repeat var="elem" value="#{yourMB.yourDataList}">
        <tr>
            <td>#{elem.userid}</td>
            <td>
               <h:outputText value="#{elem.name}" 
                    rendered="#{not elem.editable}" />
               <h:inputText value="#{elem.name}" rendered="#{elem.editable}" />
            </td>
            <td>
               <h:outputText value="#{elem.telephone}" 
                    rendered="#{not elem.editable}" />
               <h:inputText value="#{elem.telephone}"
                            rendered="#{elem.editable}" />
            </td>
            <td>
              <h:commandLink value="Edit" rendered="#{not elem.editable}"
                 action="#{yourMB.editAction(elem)}" />
            </td>
        </tr>
    </ui:repeat>
</table>
<h:commandButton value="Save Changes" action="#{yourMB.saveAction}" />

Upvotes: 2

Views: 1231

Answers (1)

Sai Ye Yan Naing Aye
Sai Ye Yan Naing Aye

Reputation: 6738

The answer is "NO". Try to use h:dataTable instead of h:panelGrid.

Upvotes: 2

Related Questions