5 Replies Latest reply on Mar 23, 2009 1:37 PM by Nick Belaevski

    Rich:Tree not efficient?

    Stephan B Newbie

      Hi,

      I'm playing around with the rich:tree component and especially its switch type options. I'm not yet sure if 'ajax' or 'client' is the best for me.

      What I noticed is that when 'ajax' is enabled and a node is expanded/collapsed, the whole tree is re-rendered, is my observation correct (I used Firebug Console)?

      Is there a reason to not re-render the specific node only?

      Cheers,
      Stephan

        • 1. Re: Rich:Tree not efficient?
          Nick Belaevski Master

          Hi Stephan,

          That's not true. Only expanded/collapsed node contents should be re-rendered. Firebug may be wrong, please check response content using a4j:log or some external tool like MS Fiddler, Eclipse TCP monitor or any sniffer able to decode HTTP requests.

          BTW, do you re-render tree explicitly?

          • 2. Re: Rich:Tree not efficient?
            Stephan B Newbie

            Thanks for your reply.

            It seems like I got confused with the console outputs. I did my requests again and it works like you say, perfect :-)

            Though it would be interesting if one could cache the children of an expanded node, to reduce the traffic/costs for a repeated expansion.

            Do you think this would be useful?

            • 3. Re: Rich:Tree not efficient?
              Stephan B Newbie

              By the way, there is only one "problem" I still got with the tree component.

              I got a ajax status that blocks the UI for the duration of the request (e.g. when an item from the tree is selected and details are shown in a separate panel). I also have D'n'D enabled. But these two obviously interfere with another. Whenever I want to drag an item, it is selected first (hence the UI is blocked).

              I thought
              - either the tree could detect (on the client side!) that the item is already selected ("disabling re-selection") and therefore not issue an AJAX server request (so that the status is not shown)
              - OR the selection could only be invoked when the mouse button is released (therefore not showing status when dragging).

              What do you think?

              Cheers,
              Stephan

              • 4. Re: Rich:Tree not efficient?
                Nick Belaevski Master

                 

                "stephanos" wrote:
                Thanks for your reply.

                It seems like I got confused with the console outputs. I did my requests again and it works like you say, perfect :-)

                Though it would be interesting if one could cache the children of an expanded node, to reduce the traffic/costs for a repeated expansion.

                Do you think this would be useful?

                Probably, but this will require implementation of some refresh policy, that will allow end developer to control updates. You can fill in JIRA RFC if you feel you need this.

                • 5. Re: Rich:Tree not efficient?
                  Nick Belaevski Master

                   

                  "stephanos" wrote:

                  - either the tree could detect (on the client side!) that the item is already selected ("disabling re-selection") and therefore not issue an AJAX server request (so that the status is not shown)
                  Client-side selection can be outdated if something is changed on the server, so looks like we need this new request.

                  "stephanos" wrote:
                  - OR the selection could only be invoked when the mouse button is released (therefore not showing status when dragging).

                  This will:
                  1. Break back compatibility
                  2. Is inconsistent with the common UI behavior (e.g. in windows explorer: selection is done on mouse button down and not up)