0 Replies Latest reply on Jun 29, 2007 6:26 PM by Yannick Lazzari

    RichFaces 3.0.2: bug with remember treeNode expanded state??

    Yannick Lazzari Newbie

      Hi,

      I noticed that recently the tree component was modified to remember the expanded state of every node on each post back. This works great but I found an unexpected behaviour and I wanted to know if it's a bug or that's the way it should work.

      Let's assume the following structure:

      A--+
      | |
      | +-- A1
      | +-- A2
      |
      B--+
       |
       +-- B1
       +-- B2
      


      At first, all the nodes are collapsed. Now, the user opens node B to reveal node B1 and B2. He does something that generates a post back. During that post back, a node is inserted in the middle of the tree. The structure now looks like this:

      A--+
      | |
      | +-- A1
      | +-- A2
      |
      C--+
      | |
      | +-- C1
      | +-- C2
      B--+
       |
       +-- B1
       +-- B2
      


      One could expect that when the tree is re-rendered, the nodes A and C would be collapsed and node B would still be expanded. But, that isn't the case. After the re-render, it's now the C node that is expanded and the B node is collapsed. I've done other tests and it seems that the expanded state is remembered based on the position in the tree, not based on the "identity" of the node. Is this a bug or is this the expected behaviour? If it is the expected behaviour, is it because remembering the expanded state based on the "identity" of the node is impossible?

      Thank you.