0 Replies Latest reply on Feb 4, 2009 6:31 PM by Matthew na

    rich:dataTable filtering loses focus when inside <a4j:output

    Matthew na Newbie

      Hi everyone,

      today I have found one interesting issue I cannot cope with.
      I used this source, from rich demo page:

      <rich:dataTable value="#{dictionaryEditor.dictionaryEntries}" var="cap" rows="20" reRender="ds" id="simpletable">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column colspan="2" >
       <h:outputText value="Filtering Example"/>
       </rich:column>
       <rich:column breakBefore="true">
       <h:outputText value="State Name"/>
       </rich:column>
       <rich:column>
       <h:outputText value="State Capital"/>
       </rich:column>
       </rich:columnGroup>
       </f:facet>
       <rich:column filterBy="#{cap.paramId}" filterEvent="onkeyup">
       <f:facet name="header">
       <h:outputText value=" " title="Hack due to bug. Shuold be remoevd till release"></h:outputText>
       </f:facet>
       <h:outputText value="#{cap.paramId}"/>
       </rich:column>
       <rich:column filterBy="#{cap.paramValue}" filterEvent="onkeyup">
       <h:outputText value="#{cap.paramValue}"/>
       </rich:column>
       <f:facet name="footer">
       <rich:datascroller id="ds" renderIfSinglePage="false"></rich:datascroller>
       </f:facet>
       </rich:dataTable>
      


      and it work pretty well.

      Unfortunately, my real table should be within a page with many of a4j:commandButtons and a4j:support. In such a case I have always been using:
      <a4j:outputPanel ajaxRendered="true">
       <a4j:commandButton ... />
       <h:selectOneMenu ....>
       <a4j:support ..... />
       </h:selectOneMenu .....>
      </a4j:outputPanel>
      
      and didn't care about reRender attributes. So, if I surround my whole page with this outputPanel suddenly rich:dataTable stops working. Because of 'onkeyup' event I can put only one letter into column text input field (filter) and then ajax request is sent. When answer becomes my table rerenders, but i lose focus on this input. In that way, I can only filter by first sign or click somewhere into input to focus it after every letter.

      What's most interesting when I substituted a4j:outputPanel with rich:panel with id and specifiy this id in every a4j component reRender attribute - the same situation happens (loses focus). Looks like there are double ajax request or sth?

      I tried with <a4j:queue /> but it didn't seem to work. Do you have any ideas how to use default rich:dataTable filtering mechanizm when its surrounded by a4j:outputPanel ?

      Thanks in advance,
      Matthew