-2

ドロップダウンで値を選択すると、パネル id=abc が表示されるシナリオがあります。コード改善のための提案....よろしくお願いします...

    <p:selectOneMenu id="zoo" value="#{cc.attrs.bean.test}" style="width:150px"  label="#{hello.description}" 
            converter="testConverter">
                 <p:ajax event="change" listener="#{cc.attrs.bean.onTest}" update="abc"/>
                 <f:selectItems value="#{cc.attrs.bean.sooo}" var="soh" itemLabel="#{soh.ex1}" itemValue="#{soh}"/>
             </p:selectOneMenu>

             <p:accordionPanel style="width:580px;" id="xyz">
    <p:tab title="Test for tab"id="hfg">
    <p:outputPanel style="width:525px;display:block" id="abc" > 
<ui:repeat id="foo" value="#{cc.attrs.bean.animal}" var="yyy">
<h:panelGroup rendered="#{!yyy.aaa}"  id="ppp">
<h:outputText value="#{yyy.flower />
<p:selectOneMenu id="wooo" value="#{yyy.house}" label="#{yyy.car}" converter="yyyConverter">
<f:selectItem itemLabel="" itemValue="" />  
<f:selectItems value="#{yyy.example}" var="sss" itemLabel="#{sss.p1}:#{sss.dp2}" itemValue="#{sss}"/>
</p:selectOneMenu>
</h:panelGroup>
</ui:repeat>

4

1 に答える 1

1

問題は、ID を持つ別の要素 (p:tab) に埋め込まれている要素 (p:outputPanel) を更新しようとしており、その p:tab も ID を持つ p:accordionPanel に埋め込まれていることです。以下のように update 属性ですべての親 ID を指定する必要があります。

  <p:selectOneMenu id="zoo" value="#{cc.attrs.bean.test}" style="width:150px"  label="#{hello.description}" 
    converter="testConverter">
         <p:ajax event="change" listener="#{cc.attrs.bean.onTest}" update="xyz:hfg:abc"/>
         <f:selectItems value="#{cc.attrs.bean.sooo}" var="soh" itemLabel="#{soh.ex1}" itemValue="#{soh}"/>
  </p:selectOneMenu>

  <p:accordionPanel style="width:580px;" id="xyz">
  <p:tab title="Test for tab" id="hfg">
    `enter code here`
    <p:outputPanel style="width:525px;display:block" id="abc" >    
    </p:outputPanel>
  </p:tab>

また、id=hfg を使用して、タイトルと p:tab の ID の間にスペースを入れる必要があります。

于 2016-02-05T08:24:15.470 に答える