6 Replies Latest reply on May 31, 2010 9:07 PM by Miggl

    Dynamic Tree Filter?

    Miggl Level 1

      Hi All,

       

      I am trying to filter the dataProvider of my tree control to only display certain items based on filtering criteria.

      The dataProvider for my tree is a custom data Descriptor based on DefaultDataDescriptor.

       

      How do I accomplish filtering?

       

      Thanks!

        • 1. Re: Dynamic Tree Filter?
          UbuntuPenguin Level 4

          Placing a filter on the collection doesn't work ?


          • 2. Re: Dynamic Tree Filter?
            Miggl Level 1

            Well, my data collection is not an ArrayCollection, but rather a custom DataDefinition class, which inherits from the DefaultDataDefinition class. I didn't see any filtering capabilities associated with that class, like there is with the ArrayCollection class.

            • 3. Re: Dynamic Tree Filter?
              UbuntuPenguin Level 4

              Um , okay , I'm guessing that is a custom class because I can't find it in the API. I would try to get an ArrayCollection in there somewhere , even if only as the result of a getter method.  If I remember correctly , tree items have to have a "children" collection , try putting some filter logic in that.  It's ugly and is just all around terrible but it might work.  But like I said before , try use what the language gives you first and foremost.

               

              Sincerely ,

                Ubu

              1 person found this helpful
              • 4. Re: Dynamic Tree Filter?
                Miggl Level 1

                Makes sense. I think I mis-typed above. Reade DefaultDataDescriptor class, instead of DefaultDataDefinition.

                I went that route because it appears that the tree component handles those best (it conforms to the ITreeDataDescriptor interface), which provide it with the functionality it needs, along with the children property.

                 

                Using this makes it much easier to construct my hierarchical data set - at least this is the only solution I have been able to find that seems to work so far.

                • 5. Re: Dynamic Tree Filter?
                  UbuntuPenguin Level 4

                  Okay , so the Value Object implements DefaultDataDescriptor , and the tree shows the VOs.  Now what contains the VOs ?

                  • 6. Re: Dynamic Tree Filter?
                    Miggl Level 1

                    Yes, you put it much better than I did. That's the situation. The VOs contain themselves. If a VO has children, it contains them as well. If not, then not. Presenting this object to the tree seems to work.

                     

                    When constructing the VO from the data source, I recursively populate it with any children using the addChildAt() function inherited by the DefaultDataDescriptor.