3 Replies Latest reply on Aug 9, 2007 2:38 AM by Michal Glowacki

    Rerender of inputText in a4j:repeat

    Michal Glowacki Novice

      hi

      I have read posts regarding rerendering of input components (those 4 places where value is stored, value, submittedValue etc) but I cannot make it working with repeat component. What I have are 2 datatables (ok, one repeat and one datatable), one with visible (on other page) data, second with hidden. Each row in visible ones repeat contains a4j:commandButton 'hide' which sets status of current item to hidden, and then rerender both tables. Also each item in repeat has some inputText components. The problem is, when I click 'hide' on for example item no. 2, after rerender, item 3 has values of inputs from old item no 2!

      I have solved the problem by adding oncomplete attribute, which clicks invisible <a4j:commandButton ajaxSingle="true" reRender="visibleDataTable" immediate="true"/>. It works, but results in some delay. How can I solve it in different way? Like I wrote before, setting inputText value, submittedValue to null in 'hide' button action code doesn't help.

      This is really important for me, any help would be appreciated.
      Michal

        • 1. Re: Rerender of inputText in a4j:repeat
          Michal Glowacki Novice

          anyone? at least any hints. maybe a way to set value of each inputText to null in given datatable row?

          • 2. Re: Rerender of inputText in a4j:repeat
            Igor Shabalov Apprentice

            can you start from posting code snipped of your page?

            • 3. Re: Rerender of inputText in a4j:repeat
              Michal Glowacki Novice

               

              <a4j:outputPanel id="itemsPanel" ajaxRendered="true">
               <h:panelGrid cellpadding="0" cellspacing="0" style="width: 100%">
               <a4j:repeat binding="#{pageBean.itemsDataTable}" id="itemsDataTable" value="#{pageBean.itemsTable}" var="currentRow">
               <t:htmlTag rendered="#{currentRow.visible}" value="tr">
               <t:htmlTag styleClass="column_middle_center" value="td">
               <a4j:commandButton action="#{pageBean.hideitem}" ajaxSingle="true" reRender=?itemsPanel,invisibleitemsDataTable? styleClass="Btn2Mni" value="Hide"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText2}" id="outputText2" value="Visib."/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_left" value="td">
               <h:outputText binding="#{pageBean.outputText3}" id="outputText3" value="#{currentRow['name']}"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText4}" id="outputText4" value="Type"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_top_center" value="td">
               <h:panelGrid cellpadding="0" cellspacing="0" columnClasses="column_middle_center" columns="1">
               <ui:textField binding="#{pageBean.item1Value}" id="item1Value" immediate="true"
               style="width: 40px; text-align: right; font-weight: bold" text="#{currentRow['items1']}" toolTip="#{currentRow.item1Name}"/>
               <h:outputText binding="#{pageBean.item1BetsNumber}" id="item1BetsNumber"
               style="font-size: 10px; font-face: verdana" value="#{currentRow['item1Price']}(#{currentRow['orders1Number']})"/>
               <h:inputHidden value="#{currentRow['item1IdLabel']}"/>
               </h:panelGrid>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText6}" id="outputText6" value="1"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_top_center" value="td">
               <h:panelGrid cellpadding="0" cellspacing="0" columnClasses="column_middle_center" columns="1" style="width: 100%">
               <h:outputText rendered="#{!currentRow.threeWayitem}" style="width: 100%; text-align: center" value="#{currentRow.items2}"/>
               <ui:textField binding="#{pageBean.item2Value}" id="item2Value" immediate="true" rendered="#{currentRow.threeWayitem}"
               text="#{currentRow.items2}" style="width: 40px; text-align: right; font-weight: bold" toolTip="#{currentRow.item2Name}"/>
               <h:outputText binding="#{pageBean.item2BetsNumber}" id="item2BetsNumber"
               rendered="#{currentRow.threeWayitem}" style="font-size: 10px; font-face: verdana" value="#{currentRow['item2Price']}(#{currentRow['orders2Number']})"/>
               <h:inputHidden rendered="#{currentRow.threeWayitem}" value="#{currentRow['item2IdLabel']}"/>
               </h:panelGrid>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText8}" id="outputText8" value="X"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_top_center" value="td">
               <h:panelGrid cellpadding="0" cellspacing="0" columnClasses="column_middle_center" columns="1">
               <ui:textField binding="#{pageBean.item3Value}" id="item3Value" immediate="true"
               style="width: 40px; text-align: right; font-weight: bold" text="#{currentRow['items3']}" toolTip="#{currentRow.item3Name}"/>
               <h:outputText binding="#{pageBean.item3BetsNumber}" id="item3BetsNumber"
               style="font-size: 10px; font-face: verdana" value="#{currentRow['item3Price']}(#{currentRow['orders3Number']})"/>
               <h:inputHidden value="#{currentRow['item3IdLabel']}"/>
               </h:panelGrid>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText5}" id="outputText5" value="2"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_top_left" value="td">
               <h:panelGrid columnClasses="column_middle_right, column_middle_left" columns="2" style="width: 100%">
               <ui:textField binding="#{pageBean.factorText}" id="factorText" immediate="true"
               onKeyPress="return calculateFactor(event,this)" style="width: 35px; text-align: right" text="#{currentRow['factor']}"/>
               <ui:image binding="#{pageBean.calcImage}" id="calcImage" onClick="calculateitems(this)"
               style="top: 2px; position: relative" url="/resources/calc.gif"/>
               </h:panelGrid>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText7}" id="outputText7" value="Coeff."/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_center" value="td">
               <a4j:outputPanel id="blockButtonsPanel">
               <a4j:commandButton action="#{pageBean.blockitem}" ajaxSingle="true" id="blockButton1" immediate="true"
               reRender="blockButtonsPanel" rendered="#{currentRow['active']}" style="color: red" styleClass="Btn2Mni" value="Block"/>
               <a4j:commandButton action="#{pageBean.unblockitem}" id="blockButton2" immediate="true"
               reRender="blockButtonsPanel" rendered="#{!currentRow['active']}" ajaxSingle="true" style="color: green" styleClass="Btn2Mni" value="Unblock"/>
               </a4j:outputPanel>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText10}" id="outputText10" value="Active"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_center" value="td">
               <h:inputText binding="#{pageBean.alertText}" id="alertText" style="width: 40px; text-align: right;" value="#{currentRow.alert}"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText11}" id="outputText11" value="Alert"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_center" value="td">
               <h:inputText binding="#{pageBean.closeText}" id="closeText" style="width: 40px; text-align: right;" value="#{currentRow['close']}"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText12}" id="outputText12" value="Close"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_center" value="td">
               <h:inputText binding="#{pageBean.maxLossText}" id="maxLossText" style="width: 45px; text-align: right;" value="#{currentRow['maxLoss']}"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText13}" id="outputText13" value="Max.loss"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_left" value="td">
               <h:outputText binding="#{pageBean.outputText14}" id="outputText14" value="#{currentRow['info']}"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText15}" id="outputText15" value="Info"/>
               </f:facet>
               </t:htmlTag>
               <t:htmlTag styleClass="column_middle_center" value="td">
               <a4j:commandButton action="#{pageBean.finishVisibleitem}" ajaxSingle="true" immediate="true"
               onclick="if(!confirm('Finish item?')) return false;" reRender="finisheditemsDataTable" oncomplete="document.getElementById('main:itemsPanelRerenderer').click()"
               styleClass="Btn2Mni" value="Finish"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText17}" id="outputText17" value="Finish"/>
               </f:facet>
               </t:htmlTag>
               </t:htmlTag>
               </a4j:repeat>
               </h:panelGrid>
               </a4j:outputPanel>
              
              <h:panelGrid binding="#{pageBean.invisibleitemsGridPanel}" id="invisibleitemsGridPanel" style="width: 100%; border-width: 1px; border-color: black; border-style: solid; height: 100%">
               <ui:label binding="#{pageBean.label5}" id="label5" text="Invisible items"/>
               <h:dataTable binding="#{pageBean.invisibleitemsDataTable}" headerClass="list-header"
               id="invisibleitemsDataTable" rowClasses="list-row-even,list-row-item"
               value="#{pageBean.invisibleitemsTable}" var="currentRow">
               <h:column binding="#{pageBean.column17}" id="column17">
               <a4j:commandButton action="#{pageBean.showitem}" ajaxSingle="true" immediate="true" reRender=?itemsPanel,invisibleitemsDataTable? styleClass="Btn2Mni" value="Show"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText26}" id="outputText26" value="Visib."/>
               </f:facet>
               </h:column>
               <h:column binding="#{pageBean.column16}" id="column16">
               <h:outputText binding="#{pageBean.outputText22}" id="outputText22" value="#{currentRow.name}"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText24}" id="outputText24" value="item"/>
               </f:facet>
               </h:column>
               <h:column binding="#{pageBean.column18}" id="column18">
               <a4j:commandButton action="#{pageBean.finishInvisibleitem}" immediate="true"
               onclick="if(!confirm('Finish item?')) return false;"
               reRender="invisibleitemsDataTable,finisheditemsDataTable" styleClass="Btn2Mni" value="Finish"/>
               <f:facet name="header">
               <h:outputText binding="#{pageBean.outputText28}" id="outputText28" value="Finish"/>
               </f:facet>
               </h:column>
               </h:dataTable>
               </h:panelGrid>