4 Replies Latest reply on Mar 2, 2010 10:37 AM by Kito Mann

    DataTable custom filtering quirks

    Kito Mann Apprentice

      I've been working with the custom filtering for the standard RichFaces DataTable lately, and I've noticed a few significant problems. I'm using RichFaces 3.3.2SR1 on Mojarra 1.2_13. The basic approach I'm using is based on Max's post here: http://mkblog.exadel.com/maxablog/richfaces-filtering-with-custom-function/. I'm seeing the following issues:

       

      • If you use this approach with custom sorting, the sort icons appear below the input control, which is pretty unattractive. I imagine it might be possible to fix this via CSS, but I'm not sure. The other choice is custom sorting, but that's a pain just to move the location of the sort icon. It'd be nice if you could just use a facet for the sort icons, which would give developers some control.
      • Setting the focus attribute on the <a4j:support> component doesn't work consistently (at least when used inside of a custom filter control). In Firefox 3.5/3.6, it doesn't work at all. It works in IE 6. The problem, though is that if the requestDelay is high enough, it's possible that the user has moved to another control before the Ajax refresh happens, in which case the focus is moved _back_ to the control with the <a4j:support> element. Tweaking requestDelay isn't really a foolproof way to get around this; ideally we want the focus to go back to the _last_ control that had focus, whatever control that was.
      • The focus issue is a real pain, and is caused because the whole DataTable is updated. Is there a way to update the whole table_except_ the headers? That would alleviate a lot of stress.
      • The setCaretToEnd() JavaScript function in the demo works very poorly in IE 6 (it can cause an infinite loop in the browser). I think there should be some notes about it -- it's a quirky implementation.

       

      Any solutions to these issues would be highly appreciated.

       

      -- Kito

        • 1. Re: DataTable custom filtering quirks
          Ilya Shaikovsky Master

          1) the result of the next code:

          <rich:dataTable value="#{capitalsBean.capitals}" var="cap" id="table" rows="20">
          <rich:column filterMethod="#{filteringBean.filterStates}" sortBy="#{cap.state}">
                              <f:facet name="header">
                                   <h:inputText value="#{filteringBean.filterValue}" id="input">
                                        <a4j:support event="onkeyup" reRender="table , ds2"
                                             ignoreDupResponses="true" requestDelay="700"
                                             oncomplete="setCaretToEnd(event);"/>
                                   </h:inputText>
                              </f:facet>
                              <h:outputText value="#{cap.state}" />
                         </rich:column>
          

          attached as "success" named image. let me know what I'm missing please.

          2) redesign of built-in focus handling targeted to 4.x

          3) partial components updates (only body of the table or only tab headers line in tabPanel) targeted as feature of 4.x

          4) https://jira.jboss.org/jira/browse/RF-8439 we will fix this.

          • 2. Re: DataTable custom filtering quirks
            Kito Mann Apprentice

            Hello Ilya,

             

            Thanks for the response. Comments below:

             

            1. Ah, thanks -- looks like I just had a simple CSS issue. FYI, your example doesn't include a <h:panelGroup> inside of the facet, so it doesn't work properly (doesn't matter for this problem; just wanted to let you know).

             

            4. Will you be posting the corrected function on JIRA for those of us who aren't yet using 3.3.3?

             

            Also, will 3.3.3 support JSF 1.2? I'm guessing not...

             

            -- Kito

            • 3. Re: DataTable custom filtering quirks
              Ilya Shaikovsky Master
              FYI, your example doesn't include a <h:panelGroup> inside of the facet, so it doesn't work properly (doesn't matter for this problem; just wanted to let you know).

              hmm... but the example just copy/pasted from livedemo And panelGroup not needed if I'm including only one component to facet.

               

              4. Will you be posting the corrected function on JIRA for those of us who aren't yet using 3.3.3?

              I'll add comment to post the solution also but anywa it will be available in livedemo page and through fisheye at jira.

               

              Also, will 3.3.3 support JSF 1.2? I'm guessing not...

               

              http://in.relation.to/14509.lace JSF 2 has limited support in 3.3.x but JSF 1.2 is main target for the branch.

              • 4. Re: DataTable custom filtering quirks
                Kito Mann Apprentice
                a

                ilya_shaikovsky wrote:

                 

                FYI, your example doesn't include a <h:panelGroup> inside of the facet, so it doesn't work properly (doesn't matter for this problem; just wanted to let you know).

                hmm... but the example just copy/pasted from livedemo And panelGroup not needed if I'm including only one component to facet.

                 

                Ah, right. I was thinking the <h:outputText> as the header, but I see the example has a separate columnGroup.

                 

                Will you be posting the corrected function on JIRA for those of us who aren't yet using 3.3.3?

                I'll add comment to post the solution also but anywa it will be available in livedemo page and through fisheye at jira.

                 

                Also, will 3.3.3 support JSF 1.2? I'm guessing not...

                 

                http://in.relation.to/14509.lace JSF 2 has limited support in 3.3.x but JSF 1.2 is main target for the branch.

                 

                Great. Thanks!