简体   繁体   中英

p:commandbutton update does not work

I have searched through forums and am aware of how id-generation of HTML-DOM-Elements work with NamingContainers and without them. Nonetheless, in this code i try to put a commandbutton in one side of the page, that should trigger an update of the other side of the page.

The 'viewWorkbenchButton' fires its action properly and the backend-data is fine. But :wbManageForm:wbMgmtPanel is not updated.

<ui:composition xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">

<f:view>
    <p:panel id="dataGridPanel">
        <p:panelGrid id="dataGridPanelGrid" styleClass="pGrid" columns="2"
            columnClasses="alignTop, alignTop">
            <p:column>
                <h:form id="wbSelectForm">
                    <p:panel styleClass="noBorderPanel">
                        <p:dataTable var="workbench"
                            value="#{WorkbenchControllerBean.myWorkbenches}"
                            paginator="#{WorkbenchControllerBean.myWorkbenches.size() > 10}"
                            rows="10"
                            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}">
                            <f:facet name="header">  
                                    My Workbenches  
                                </f:facet>

                            <p:column headerText="Id" sortBy="#{workbench.workbenchId}">
                                <h:outputText value="#{workbench.workbenchId}" />
                            </p:column>

                            <p:column headerText="Name" sortBy="#{workbench.name}">
                                <h:outputText value="#{workbench.name}" />
                            </p:column>

                            <p:column headerText="Actions">
                                <p:commandButton id="viewWorkbenchButton" icon="ui-icon-show"
                                    title="View Workbench" update=":wbManageForm:wbMgmtPanel"
                                    actionListener="#{WorkbenchControllerBean.viewWorkbench(workbench)}">
                                </p:commandButton>

                            </p:column>
                        </p:dataTable>
                    </p:panel>
                </h:form>
            </p:column>

            <p:column>
                <h:form id="wbManageForm">
                    <p:panel id="wbMgmtPanel" styleClass="noBorderPanel">
                        <h:outputText id="tabText" value="Active Wb: #{WorkbenchControllerBean.number}" />
                        <p:tabView id="tabView">
                        ....
                        </p:tabView>

                    </p:panel>
                </h:form>
            </p:column>
        </p:panelGrid>
    </p:panel>
</f:view>

I already tried to update different components ( :wbManageForm , :wbManageForm:tabText , :wbManageForm:tabView:treetable ) but none of them was updated...

I am using Primefaces 3.5.

What am i missing here? Thanks a lot in advance!

Try using action instead of actionListener . Also, update only the wbmanageForm . If that doesn't work, try updating the component with your bean method.

You can do that by adding this to the end of your method: RequestContext.getCurrentInstance().update("wbManageForm");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM