5 Replies Latest reply on Jul 31, 2007 11:28 AM by Konstantin Kauz

    Function is to often called

    Konstantin Kauz Novice

       

      <h:dataTable value="#{catList}" var="cat">
       <h:column>
       <br/>
       <h:dataTable var="tour" value="#{cat.tournaments}">
       <h:column>
       <br/>
       <h:panelGrid columns="1"
       headerClass="table_events_head" styleClass="table_events" >
       <f:facet name="header">
       <h:outputText value="#{cat.bezeichnung}, #{tour.bezeichnung}"/>
       </f:facet>
      
       <a4j:form>
       <h:dataTable id="bts" value="#{tour.wetts}" var="wette">
       <h:column>
       <h:outputText value="#{wette.strt}" > <s:convertDateTime type="date" pattern="dd-MM"/></h:outputText>
       <h:outputText value=" " />
       <h:outputText value="#{wette.startT}"> <s:convertDateTime type="time" pattern="HH:mm" /></h:outputText>
       </h:column>
      
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{msg.storeNameLabel}"/>
       </f:facet>
       <h:outputText value="#{wette.homeTeam.bezeichnung}"/>
       <h:outputText value=" - " />
       <h:outputText value="#{wette.gastTeam.bezeichnung}"/>
      
       </h:column>
      
       <h:column rendered="#{not empty wette.dwette}">
      
      
       <h:inputHidden id="hid" value="#{wette.id}" />
       <h:inputHidden id="hidow" value="#{wette.own}" />
       <a4j:region renderRegionOnly="false">
       <a4j:commandLink value="home: #{wette.dwette.one}" action="#{navi.addOneDreier(wette)}" reRender="ticket"/>
       </a4j:region>



      and ticket is follow:


      <h:panelGroup id="ticket">
      
       <h:panelGrid columns="6">
      
       <h:outputText id="qt" value="#{navi.getQt()}" />
       <a4j:region renderRegionOnly="true">
       <h:inputText value= "#{navi.einsatz}" >
       <a4j:support event="onkeyup" reRender="gewinn" />
       </h:inputText>
      
       <h:outputText value="Gewinnchance " />
       <h:outputText id="gewinn" value="#{navi.getQuote()}"/>
       </a4j:region>
       </h:panelGrid>
      
       <h:dataTable value="#{navi.bets}" var="bet">
       <h:column>
       <h:outputText value="System !!!" rendered="#{navi.state}"/>


      if i push <a4j:commandLink value="home: #{wette.dwette.one}" action="#{navi.addOneDreier(wette)}" reRender="ticket"/>

      and the navi.state has a counter
      <h:outputText value="System !!!" rendered="#{navi.state}"/>


      public boolean getState(){
      System.out.println("------------------ counter " + counter++);
      return true;
      }

        • 1. Re: Function is to often called
          Konstantin Kauz Novice

          by 7 push of button the counter is over one hundreds, why it is so?
          the size of Lists is correct!

          • 2. Re: Function is to often called
            Ilya Shaikovsky Master

            Seems its expected. Because getter for the rendered property called on almost every phase of the JSF lifecycle and for every output populated while iterating list.

            • 3. Re: Function is to often called
              Konstantin Kauz Novice



              <s:div id="footer_ticket">
               <a4j:form>
               <a4j:outputPanel layout="none">
               <h:panelGroup id="ticket">
              
               <h:panelGrid columns="6">
              
               <h:outputText value="Gesamtquote " />
               <h:outputText id="qt" value="#{navi.getQt()}" />
               <h:outputText value="Einsatz " />
               <a4j:region renderRegionOnly="true">
               <h:inputText value= "#{navi.einsatz}" >
               <a4j:support event="onkeyup" reRender="gewinn" />
               </h:inputText>
              
               <h:outputText value="Gewinnchance " />
               <h:outputText id="gewinn" value="#{navi.getQuote()}"/>
               </a4j:region>
               <a4j:region renderRegionOnly="true">
               <h:outputText value="System " rendered="#{not empty navi.systemList}"/>
               <h:selectOneMenu id="sel_system" value="#{navi.system}" rendered="#{not empty navi.systemList}">
               <s:selectItems value="#{navi.getSystemList()}" var="systemitem" label="#{systemitem.label}"/>
               <f:converter converterId="sysConverter" />
               <a4j:support event="onchange" reRender="ticket" />
               </h:selectOneMenu>
               </a4j:region>
               </h:panelGrid>
              
               <h:dataTable value="#{navi.bets}" var="bet">
               <h:column>
              
               <h:panelGrid columns="12" rendered="#{navi.getBetsel(bet).dreier == true}">
              
               <h:outputText value="Dreier Wette"/>
               <h:outputText value="#{bet.strt}" > <s:convertDateTime type="date" pattern="dd-MM"/></h:outputText>
               <h:outputText value=" - " />
               <h:outputText value="#{bet.startT}"> <s:convertDateTime type="time" pattern="HH:mm" /></h:outputText>
              
              
               <h:outputText value="#{bet.homeTeam.bezeichnung} - #{bet.gastTeam.bezeichnung}"/>
              
              
               <h:outputText value="Home: #{bet.dwette.one}"/>
               <a4j:region renderRegionOnly="true">
               <h:selectBooleanCheckbox
               title="home"
               value="#{navi.getBetsel(bet).home}" >
              
               <a4j:support actionListener="#{navi.setCheckBox(bet)}" event="onmouseup" reRender="ticket">
               <f:param name="art" value="#{types.DREIERW}" />
               <f:param name="team" value="#{types.HOME}" />
               </a4j:support>
               </h:selectBooleanCheckbox>
               </a4j:region>
              


              if i check or uncheck the checkbox it works after two clicks:

              <h:selectBooleanCheckbox
               title="home"
               value="#{navi.getBetsel(bet).home}" >
              
               <a4j:support actionListener="#{navi.setCheckBox(bet)}" event="onmouseup" reRender="ticket">
               <f:param name="art" value="#{types.DREIERW}" />
               <f:param name="team" value="#{types.HOME}" />
               </a4j:support>
               </h:selectBooleanCheckbox>



              What i make wrong or is it a bug?

              • 4. Re: Function is to often called
                Igor Shabalov Apprentice

                What works after two clicks? What do not works before?
                What scope is #{navi}? Why

                <a4j:outputPanel layout="none">
                <h:panelGroup id="ticket">

                cannot be just <a4j:outputPanel id=ticket>

                We need more details here.