Add row in dataTable

UI Components for JSF
Post Reply
funkybreizh
Posts: 5
Joined: 23 Aug 2011, 16:00

03 Oct 2011, 15:21

Hi,

I try to dynamically add row in datatable. I want the user click on add button which open a dialog with a form, and then click on "ok" button to add the row.
I 'm able to do this, but just the first time. If I retry, it doesn't work but if I refresh I see the new row.

Here is my dialog, I include the form :

Code: Select all

<p:dialog header="My Dialog" widgetVar="dialog">
    <h:form>
	<ui:include src="form.xhtml" />
	<p:commandButton value="Ok" update="@form :main_form" actionListener="#{myBean.addRow}" oncomplete="handleDialogClose(xhr, status, args)" />
   </h:form>
</p:dialog>
Here is myBean :

Code: Select all

public void addRow(ActionEvent event) {
    MyObject object = myFormBean.getMyObject();
   ((Collection<MyObject>) this.getDataModel().getWrappedData()).add(object);
}
As I write it works the first time, but the second time, the methods is well called, but there's no update on the screen, and if I refresh, the row is well add.

I really don't understand the problem.

Thanks.
Mojara 2.12
Primefaces 3.0.M3

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 48 guests