1 Reply Latest reply on Oct 8, 2010 8:54 AM by Ilya Shaikovsky

    datatable with filter lose focus when reRender it

    Jorge Davison Newbie

      Hi, i have a rich:datatable with filters made by filterBy, and a ajax polling a4j:poll to reRender the datatable after X second. When the filtering in the datatable is being doing, and a poll to the server was did in the same moment, i lose the focus in the input filter when the datatable was refreshed.

       

      Some part of my code:

       

      <a4j:poll id="poll" interval="#{adminController.refreshPeriod}" reRender="poll,historyTable" action="#{adminController.update}" />

       

      ....

       

      <rich:dataTable id="historyTable" value="#{queuesController.deletedQueues}" var="q" width="100%" styleClass="qsilver-cell">
                  <f:facet name="header">
                      <rich:columnGroup>
                          <rich:column>
                              <h:outputText value="#{Message.queue_id}" title="#{Message.queue_id_tooltip}"/>
                          </rich:column>
                          <rich:column>
                              <h:outputText value="#{Message.queue_group}" title="#{Message.queue_group_tooltip}"/>
                          </rich:column>
                          <rich:column>
                              <h:outputText value="#{Message.queue_campaign}" title="#{Message.queue_campaign_tooltip}"/>
                          </rich:column>
                          <rich:column>
                              <h:outputText value="#{Message.queue_client}" title="#{Message.queue_client_tooltip}"/>
                          </rich:column>
                          <rich:column>
                              <h:outputText value="#{Message.queue_tps}" title="#{Message.queue_tps_tooltip}"/>
                          </rich:column>
                          <rich:column>
                              <h:outputText value="#{Message.queue_priority}" title="#{Message.queue_priority_tooltip}"/>
                          </rich:column>
                          <rich:column>
                               <h:outputText value="#{Message.queue_createdOn}" title="#{Message.queue_createdOn_tooltip}"/>
                              </rich:column>
      <rich:column>                   
                               <h:outputText value="#{Message.queue_scheduledDate}" title="#{Message.queue_scheduledDate_tooltip}"/>
                              </rich:column>
                          <rich:column>
                               <h:outputText value="#{Message.queue_startedOn}" title="#{Message.queue_startedOn_tooltip}"/>
                          </rich:column>
                          <rich:column>
                               <h:outputText value="#{Message.queue_deletedOn}" title="#{Message.queue_deletedOn_tooltip}"/>
                              </rich:column>
                          <rich:column>
                               <h:outputText value="#{Message.queue_canceled}" title="#{Message.queue_canceled_tooltip}"/>
                              </rich:column>
                          <rich:column>
                               <h:outputText value="#{Message.queue_actions}" title="#{Message.queue_actions_tooltip}"/>
                              </rich:column>
                      </rich:columnGroup>
                  </f:facet>
      <rich:column filterBy="#{q.queueId}" filterEvent="onkeyup">
      <h:outputText value="#{q.queueId}"/>
      </rich:column>
      <rich:column filterBy="#{q.groupName}" filterEvent="onkeyup">
      <h:outputText value="#{q.groupName}" title="ID: #{q.groupId}"/>
      </rich:column>
      <rich:column filterBy="#{q.campaignName}" filterEvent="onkeyup">
      <h:outputText value="#{q.campaignName}" title="ID: #{q.campaignId}"/>
      </rich:column>
      <rich:column filterBy="#{q.clientName}" filterEvent="onkeyup">
      <h:outputText value="#{q.clientName}" title="ID: #{q.clientId}"/>
      </rich:column>

            <rich:dataTable id="historyTable" value="#{controller.deletedQueues}" var="q">

                  <f:facet name="header">

                      <rich:columnGroup>

                          <rich:column>

                              <h:outputText value="#{Message.queue_id}" />

                          </rich:column>

                      </rich:columnGroup>

                  </f:facet>

          <rich:column filterBy="#{q.queueId}" filterEvent="onkeyup">

      <h:outputText value="#{q.queueId}"/>

          </rich:column>

           </rich:datatable>

       

      There is a way to restore the focus to the input filter after the datatable was refreshed??

       

      Thanks!

      Jorge