<p:ajax update=“”> inside nested components

心已入冬 提交于 2019-12-13 01:48:46

问题


Iam using Mojarra 2.2.11 (WildFly 9.0.1) with PF 5.3.

In relation with my original question: <p:ajax update="...> cell or row update inside PF subTable

I am still struggling with the following line: <p:ajax update=":tabView1:form1:mainTable".../>

The following part has been changed: #{subTableView.getAllheaders(tabview)}. Below references have been used but the datatable refresh does not seem to work.

I have done several researches and tried multiple options without success. The operation looks easy: I need to process a selectOneRadio value to update the outputLabel in the next column of the datatable. I am not getting any error: but the radio selection comes back to the initial position when another radio is clicked without updating the outputlabel.

  1. I paid attention that outputLabel is surrounded by a panelGroup (see reference). NamingContainer with proper syntax has been tried:

    • BalusC ref: How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"
  2. I tried with RequestContext#update("tabView1:form1:mainTable:panel") with the below references:

    • Primefaces p:ajax listener conditional update
    • PF Showcase
  3. <f:ajax execute="" render=""/> has been tried

    • Reference: Mastering JSF 2.2 Book
  4. I was thinking about the last jQuery option but I still think it is doable with JSF.

Thank you for your time.

<p:tabView id ="tabView1" value="#{bean.titles}" var="tabItem" >

   <p:tab id="tab1" title="#{tabItem}" >

     <h:form id="form1" >

   <p:dataTable  id="mainTable" value="#{subTableView.getAllHeaders(tabItem)}" var="head" > 

     <p:subTable id="subTable1" value="#{head.questions}" var="question" >  

        <f:facet name="header">
            #{head.name}
        </f:facet>

        <p:column id="questionColumn">
            #{question.question}            
        </p:column>

        <p:column id="radioColumn">

            <p:selectOneRadio id="mainSelect" value="#{question.select1}" >

                <f:selectItem itemLabel="Yes" itemValue="#{question.responseOfYes}" />
                <f:selectItem itemLabel="No" itemValue="#{question.responseOfNo}" />

                    // here is my pain:
                <p:ajax update=":tabView1:form1:mainTable"  process="@this"

                 listener="#{subTableView.updateSecond(question.select1)}"/>

            </p:selectOneRadio>

        </p:column> 


        <p:column id="responseColumn">

            <h:panelGroup id="panel" >
                <h:outputLabel id="display1" value="#{question.select1}" />                 
            </h:panelGroup>

        </p:column>

    </p:subTable>

  </p:dataTable>    

  </h:form>

    </p:tab>

 </p:tabView>

来源:https://stackoverflow.com/questions/33637213/pajax-update-inside-nested-components

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!