2

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}" /> 
5
  • The problem with trying to do it using h:panelGrid is that you can't iterate through a list inside it. h:panelGrid is more like a container where you arrange UI widgets, and ui:repeat and h:dataTable are the ones appropriate for iterating through a list/collection. Commented Jul 26, 2012 at 22:51
  • 8
    Why exactly do you need h:panelGrid instead of h:dataTable? Commented Jul 26, 2012 at 23:38
  • 2
    The answer to your concrete (and rhetorical) question is just "no" and already answered in a basic JSF book/tutorial or at least by just logically thinking. Is a bounty really needed for that? To better understand your strange question so that a better answer than just "no" can be posted, I have posted the above comment with a sensible contra-question which you never gave feedback on for some reason. What exactly do you want? Commented Jul 31, 2012 at 12:39
  • You can try inplace component from primefaces primefaces.org/showcase-labs/ui/inplace.jsf Commented Jul 31, 2012 at 20:27
  • If you're trying to use JSF to loop over data and build up a table manually then you are really missing the boat with reference to its Component basis. Commented Jul 31, 2012 at 22:24

1 Answer 1

2
+25

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.