Note that there are some explanatory texts on larger screens.

plurals
  1. POPrimefaces dataTable only adding a single row
    primarykey
    data
    text
    <p>I've been digging through the archives to find an answer that might help, but nothing really seems to apply.</p> <p>I have a page in jsf with nested dataTables that is holding a list from the backing bean. The page seems to be holding the data without any issues, but when I attempt to add rows either of my dataTables using the p:collector Primefaces object, my dataTable only ever displays a single row. I am always adding an empty object to both lists.</p> <p>The objects contained in the list are custom objects that implement Serializable.</p> <p>My backing bean is ConversationScoped, and the data in the backing bean is instantiated when the conversation is started.</p> <p>Here is my main page:</p> <pre><code>&lt;ui:composition template="/templates/pageLayout.xhtml"&gt; &lt;ui:define name="pageContent"&gt; &lt;h:form id="genericWorkflowMainForm" enctype="multipart/form-data"&gt; &lt;p:panel id="actionList"&gt; &lt;div align="right"&gt; &lt;p:commandButton id="addActionButton" value="Add Action" update="actionTable" action="#{createGenericWorkflowBean.addAction}" ajax="false"&gt; &lt;p:collector id="addActionCollector" value="#{createGenericWorkflowBean.actionRow}" addTo="#{createGenericWorkflowBean.genericWorkflowData.actionGroup.actionCompletionList}"/&gt; &lt;/p:commandButton&gt; &lt;/div&gt; &lt;h:dataTable id="actionTable" var="actions" value="#{createGenericWorkflowBean.genericWorkflowData.actionGroup.actionCompletionList}"&gt; &lt;h:column&gt; &lt;h:outputLabel value="Action " /&gt; &lt;h:inputTextarea id="actionText" value="#{actions.actionRecord.actionText}" /&gt; &lt;br/&gt; &lt;p:panel id ="actioneePanel"&gt; &lt;div align="right"&gt; &lt;p:commandButton id="addApproverButton" value="Add Approver" onclick="addApprover.show()"/&gt; &lt;/div&gt; &lt;h:dataTable value="#{actions.actionRecord.actionees}" id="actioneeListValues" var="actioneeRecord"&gt; &lt;h:column&gt; &lt;h:outputText id="actioneeLabel" value="Actionee " /&gt; &lt;h:outputText id="actionee" value="#{actioneeRecord.user.user.name}" /&gt; &lt;h:outputText id="actioneeCommentlabel" value="Comments " rendered="#{actioneeRecord.user.display}"/&gt; &lt;h:inputTextarea id ="actioneeComment" value="#{actioneeRecord.userComment}" rendered="#{actioneeRecord.user.display}"/&gt; &lt;br/&gt; &lt;p:commandLink id="removeActionee" value="Remove" update="actioneeListValues" rendered="#{!actioneeRecord.user.display}"&gt; &lt;p:collector value="#{actioneeRecord}" removeFrom="#{actions.actionRecord.actionees}"/&gt; &lt;/p:commandLink&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; &lt;p:dialog id="addApprover" header="Add Approver" widgetVar="addApprover" modal="false" closable="false" resizable="false" width="250"&gt; &lt;div&gt; &lt;p:autoComplete id="autoCompleteApprover" value="#{createGenericWorkflowBean.newApprover}" /**//&gt; &lt;br/&gt; &lt;p:commandButton id="addNewApprover" title="Add Approver" value="Add" update="actioneeListValues" onclick="addApprover.hide()" ajax="false" action="#{createGenericWorkflowBean.addApprover()}"&gt; &lt;p:collector value="#{createGenericWorkflowBean.newApprover}" addTo="#{actions.actionRecord.actionees}"/&gt; &lt;/p:commandButton&gt; &lt;/div&gt; &lt;/p:dialog&gt; &lt;/p:panel&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; &lt;/p:panel&gt; &lt;/h:form&gt; &lt;/ui:define&gt; &lt;/ui:composition&gt; </code></pre> <p>Below are the parts of my backing bean that relate to the p:collector adding and removing portions of the list.</p> <pre><code>@Named @ConversationScoped public class CreateGenericWorkflowBean extends WorkflowBean { @Inject Conversation conversation; private Actionee newApprover; private ActionCompletionRecord actionRow = new ActionCompletionRecord(); private Actionee actioneeRow = new Actionee(); public GenericWorkflowData getGenericWorkflowData() { return (GenericWorkflowData) getData(); } public void addApprover() { setNewApprover(new Actionee()); } public void addAction() { actionRow = new ActionCompletionRecord(); } } </code></pre> <p>I am still learning JSF and Primefaces, so I do not know if I've done something that will just never work. </p> <p>Any help would be greatly appreciated.</p> <p>Matt Tatham</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload