Monday, April 21, 2008

Select objects (based on an property) displayed in a tree

How do you restrict the objects displayed in a Tree browser (i.e. to only display objects with specified property values) e.g. to allow for moderated views. How do you do a query and display the results in a tree browser?

1 comment:

Unknown said...

Use chained ComponentTQLNodeGeneratorConfig objects to write arbitrary TQL and use the ${component.id} token to refer to the component being expanded in the tree. For example to see top-level Category objects create CompTQLNGC with the query

component.type="Category" and component.topLevel

with a child node generator that is also a CompTQLNGC, with the TQL:

component.type="Category" and component.name contains "the rain in spain falls mainly in the plain" and component.hasParent(component.id=${component.id})

The resulting tree will show all top-level categories, followed by their immediate children whose name also contains a certain musical reference.