Board index JavaServer Faces General p:commandButton [ajax] does not update its listed id's

p:commandButton [ajax] does not update its listed id's

Components, Ajax Framework, Utilities and More.


Posts: 8
Hi,

I've been trying to use a p:commandButton in a ui:repeat, h:dataTable and a p:datatable.

Each row has its own button that is supposed assign(with Ajax) a backing bean value to an object referenced in p:dialog. In none of my attempts has the AJAX call updated the appropriate component after the call to the bean.

                 <p:dataTable var="item" value="#{backingBean.objectList}" >
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Type"/>
                        </f:facet>
                        <h:outputText value="#{object.typeValue}" />
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Edit"/>
                        </f:facet>
                        <p:commandButton
                            oncomplete="editDialog.show();"
                            update="editDialogComponent"
                            actionListener="#{backingBean.editObject}" //sets the backingBean.editableObject to point to the current row object
                            value="Edit" />
                    </p:column>
                </p:dataTable>

                <p:dialog
                        id="editDialogComponent"
                        widgetVar="editDialog"
                        header="Edit object"
                        modal="true">
                        <h:panelGrid columns="2" cellspacing="1" cellpadding="1">
                            <h:outputText value="Type" />
                            <h:outputText value="#{backingBean.editableObject.typeValue}" />
                        </h:panelGrid>
                        <p:commandButton
                            styleClass="btn"
                            onmouseover="this.className='btn btnhov'"
                            onmouseout="this.className='btn'"
                            actionListener="backingBean.saveObject"
                            value="Save" onclick="editDialog.hide();" />
                    </p:dialog>



My workaround is to have a p:commandButton outside the dataTable to actually update the DOM (with an update attrbute), then show() the dialog, but I would much prefer it can be done in one click, rather than two.

Are you aware of this?

Thanks,
Jacques
Server: Glassfish v3
JSF 2.0
Primeface 2.1.RC1

Return to General