3 Replies Latest reply on Mar 17, 2011 9:19 PM by brambilla

    a4j:poll js error

    mahbubur045

      I tried to use a4j:poll to periodically refresh some datatable. The problem occurs when I go to another page of the application and that page doesn't have any pooling, but it tries to poll from the previous page and causes the javascript error.

      How to disable the a4j:poll in previous page when I'm in a new page?

      Shouldn't it be automatically disable if I switch another page?

      Thanks in advance.

        • 1. Re: a4j:poll js error
          ilya_shaikovsky

          show us pages please.

          • 2. Re: a4j:poll js error
            mahbubur045

            Part of a page here. Most of my page have a datatable but all are not auto refresh enable. When I switch to new page which doesn't any a4j:poll but cause problem from the previous page a4j:poll.

            <a4j:outputPanel id="list_container">
            <rich:dataTable value="#{comp.listviewHandler.dynamicList}"
            var="dynamicItem" id="dataTable"
            rows="#{comp.listviewHandler.listviewSettings.maxRows}"
            rowClasses="odd_row, even_row" width="#{comp.width}px"
            onRowMouseOver="this.style.cursor = '#{cursor}'"

            onRowMouseOut="this.style.cursor=''">
            <ui:include
            src="/face4/widgets/listview/cols/cols_#{comp.listviewHandler.cols}.xhtml" />

            <a4j:support event="onRowClick" onsubmit="changeColor(this)" rendered="#{comp.listviewHandler.hasToolActions}"
            action="#{comp.listviewHandler.selectOneRecord}" reRender="listToolActions" ignoreDupResponses="true" >
            <a4j:actionparam name="listRecordPkeyParam" value="#{dynamicItem.primaryKeyValue}"></a4j:actionparam>
            </a4j:support>
            </rich:dataTable>
            <h:panelGroup>
            <rich:datascroller for="dataTable" align="left"></rich:datascroller>
            </h:panelGroup>
            </a4j:outputPanel>
            </h:panelGrid>
            </a4j:outputPanel>
            <a4j:outputPanel id="autoRefreshPoll">
            <a4j:poll rendered="#{listSettings.autoRefresh}" interval="10000" action="#{comp.listviewHandler.reloadListFromDb}"
            reRender="list_container, listToolActions" onsubmit="forceBlockUI(listAjaxStatRefresh);"
            oncomplete="forceUnblockUI();"
            ajaxSingle="true" ignoreDupResponses="true" enabled="#{listSettings.autoRefresh}"
            ></a4j:poll>
            </a4j:outputPanel>

            </h:form>
            </a4j:region>

            • 3. Re: a4j:poll js error
              brambilla

              I'm having this same problem with a4j:poll, anyone have any solutions?

              Thanks.

               

              My code:

              <a4j:region>

                          <h:form>

                            <a4j:poll id="poll" interval="5000" timeout="50000" action="#{myMB.findConfig}" reRender="gridS"/>  

                         </h:form>

              </a4j:region>

               

              <h:form>

                          <rich:dataGrid value="#{leituraMB.listaSensoresConfigurados}" id="gridS"  var="sen" columns="3" elements="9" width="100%">

                           <rich:panel bodyClass="pbody">

                              <f:facet name="header">

                                  <h:outputText value="#{sen.pcd.ds_nome_pcd}"></h:outputText>

                              </f:facet>

                              <h:panelGrid columns="2">

                                  <h:outputText value="#{i18n.label_sensor}:" styleClass="label"></h:outputText>

                                  <h:outputText value="#{sen.sensorCfg.ds_id_fisico}" />

               

                             </h:panelGrid>

                           </rich:panel>

                            <f:facet name="footer">

                               <rich:datascroller></rich:datascroller>

                            </f:facet>

                          </rich:dataGrid>

              </h:form>