No announcement yet.
  • Filter
  • Time
Clear All
new posts

    setImplicitCriteria() and setKeepParentsOnFilter() combination


    Is it possible to use setKeepParentsOnFilter(true) in combination with setImplicitCriteria(criteria) on TreeGrids such that parent(non-leaf) nodes that are outside of the implicit criteria to stay hidden? That would mean that the keepParentsOnFilter criteria would apply only on the implicit criteria subset and NOT on above parent layers. We are not able to achieve this behavior but maybe we are not aware of a certain method or flag.

    I shall try to explain the context... The idea is that when you focus on a subtree from a bigger tree using an implicit criteria, but also need to have setKeepParentsOnFilter(true) for further filtering options on that subtree, you would not want to see all the above parents of that subtree up to the top. It just does not make too much sense to see upper parents that are anyway outside of the initial criteria. I hope I make myself understood...

    Thank you!

    To feed this back, is the desire:

    a) you want to use implicitCriteria for a tree but not have it eliminate parents


    b) the reverse: you do want to eliminate parents with implicitCriteria, but once those parents are eliminated, you want the keepParentsOnFilter behavior to apply for the rest of the criteria

    If it's B, consider just adding the criteria at the DataSource layer, for example in transformRequest(). Then the tree won't be aware of it.


      Yes, it is case B but the DataSource is used by multiple components and some of them would need to display all data while others just a subset. By applying the criteria at DataSource level would mean to have different instances with different filtering criteria... We shall think about it.

      Is it possible to overwrite the code responsible with the keepParentOnFilter computation? This way we could adjust the result...

      The third option would be to stop using setKeepParentsOnFilter(true) and use a combined criteria of the initial criteria with the behavior of setKeepParentsOnFilter(true). But that would mean for us to reinvent the wheel and write code to do what the setKeepParentsOnFilter(true) already does. This solution would be an intersection(an AND operation) between the result of setKeepParentsOnFilter(true) and the result of applying the initial criteria...


        Well, we have good news - it looks like you're unaware of some basic features that will help with this and many other use cases.

        You don't have to declare a new DataSource to get a variation on default DataSource behavior, you just declare a new operationBinding and give the operationId of that binding to your TreeGrid. Then you can declaratively or programmatically add criteria to that specific operation. You can do this with all 4 operationTypes, so you can also create variants on updates, deletes, etc, and you can do things like create a fetch variant that returns limited fields (operationBinding.outputs), etc.


          Ahaaa... Thanks for the tip! This indeed sounds like it should solve the issue. We shall start to check the docs and try to implement it.