4 Replies Latest reply on Jun 20, 2007 9:37 AM by Ilya Shaikovsky

    How to: do a reRender from a popup?

    Leonardo Rafaeli Newbie

      Good morning

      This is my problem. There is a way to do a reRender in an "openner" window? I need a solution that works in ajax4jsf 1.0.2 (because 1.1 doesnt' work in JDeveloeper + OC4J and I don't know why).

      My situation

      I have a full ajaxied page like a crud. Well, I need get some items from a popup but when I close it, all data I have wrote in parent window will disapear because to open this window there is an ajax (oncomplete="window.open blabla") and this ajax MUST be with immediate=true (for not validating my last wrote data). I want a way to reRender my list of parent window from the popup.

      I've had a hack using pooling, but it isnt nice, right? lol :)

      Can anyone help me? :)

      Regard
      Leo

        • 1. Re: How to: do a reRender from a popup?
          Ilya Shaikovsky Master

          working with this vetsion isn't recomended in any way. It's too old.

          B.t.w. It would be better to paste the page you created.

          • 2. Re: How to: do a reRender from a popup?
            Leonardo Rafaeli Newbie

             

            "ilya_shaikovsky" wrote:
            working with this vetsion isn't recomended in any way. It's too old.

            B.t.w. It would be better to paste the page you created.


            Isnt' too old, I guess it is of 2006/december and works fine with my system, I don't know what happens when I change the a4j jar, but the renderization of the page will be wrong :( sometimes my application doesnt start because that jar I GUESS its because my OC4J (again! oc4j of thx)

            Well, I will paste and example:

            <h:graphicImage alt="" url="../../img/icoBusca.gif" width="19" height="18" style="cursor: pointer;">
             <a4j:support event="onclick" onsubmit="changeCursor(true);" actionListener="#{MCTrecho.carregarCidades}" reRender="cidadeSelecionada"
             oncomplete="window.open('pesquisaCidade.jsp','popup','width=450,height=800,scrollbars=1'); changeCursor(false)" />
             </h:graphicImage>


            My Table I want to be reRenderized

            <t:dataTable value="#{MCTrecho.cidadeTrechoFull}" var="ct"
             headerClass="linhaTituloResultPesq" rowClasses="linhaResultPesq, linhaResultPesq2"
             width="600" border="0" cellpadding="0" cellspacing="1"
             id="tableCidade" >
             <t:column styleClass="colunaDireita" width="10%">
             <f:facet name="header">
             <h:outputText value="Ordem"/>
             </f:facet>
             <h:outputText value="#{ct.nrOrdem}" />
             </t:column>


            My Popup that have a list of object that appears in my table

            <h:inputText value="#{MCTrecho.stNmCidade}"
             id="txtCidade" maxlength="15">
             <a4j:support actionListener="#{MCTrecho.filtrarCidades}"
             event="onkeyup" reRender="tableCidades"
             ajaxSingle="true" onsubmit="comecar();" oncomplete="terminar();"/>
             </h:inputText>
            <div style="overflow: auto">
             <h:dataTable width="370" border="0" cellspacing="0"
             cellpadding="0" value="#{MCTrecho.searchCidades}" var="cidade"
             headerClass="linhaTituloResultPesq" rowClasses="linhaResultPesqLeft"
             id="tableCidades" style="margin-top: 10px;margin-bottom: 10px" >
             <h:column id="coluna">
             <f:facet name="header">
             <a4j:status>
             <f:facet name="start">
             <h:outputText value="Carregando lista..." />
             </f:facet>
             <f:facet name="stop">
             <h:outputText value="Resultados da Pesquisa" />
             </f:facet>
             </a4j:status>
             </f:facet>
             <h:outputText value="#{cidade}"
             style="color: blue; cursor: pointer; text-decoration: underline; margin: 1px;" >
             <a4j:support event="onclick" actionListener="#{MCTrecho.cidadeSelecionada}"
             reRender="txtCidade" oncomplete="javascript:fecha()" />
             </h:outputText>
             </h:column>
             </h:dataTable>
             </div>
            


            my "fecha()" function

            function fecha(){
             b=window.opener.location="criaTrecho.jsp","Main";
             window.close()
             }


            It woks now, but I want an "ajaxied" version. With this code, it refreshes the parent window and I just want to reRender my dataTable
            There is any javascript function of ajax4jsf to reRender a specified element? I think this will help using a function like openner.myAjax4JSFFunction( 'myTableID' ) :P :P

            workaround mode on lol

            • 3. Re: How to: do a reRender from a popup?
              Leonardo Rafaeli Newbie

              I've found a way in newest a4j version using a4j:jsfunction but, this functions doesnt exist in 1.0.2 :(

              • 4. Re: How to: do a reRender from a popup?
                Ilya Shaikovsky Master

                you may download 1.0.7 version. It's not refactored as 1.1.0 - but all the fixes and if I'm not missed something components included to this build.