☝️Small business or a startup? See if you qualify for our special offer.
+

Filter By Condition On Multilevel Hierarchies

Answered
Fabio asked on May 6, 2025

It appears that filtering by negative conditions (not equal, not begin, not end, not contain) doesn't work properly in multilevel hierarchies.

For example, when I try to apply these negative filters to the Labels in the example at:

https://jsfiddle.net/flexmonster/o4jywt38/

they don't function correctly.

Could you please check this issue?

Thank you,

Fabio.

 

 

2 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 7, 2025

Hello Fabio,

Thank you for contacting us.

Our team will research possible solutions for this issue and provide you with results, ETA June 9th.

Please let us know if other questions arise.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster June 3, 2025

Hello Fabio,

Thank you for giving us some time.

After detailed research, we discovered that filters with negative conditions (not equal, not begin, not end, not contain) work as expected. We want to explain how they work in the hierarchy fields.

When a label filter is applied to a hierarchical field, the filtering applies to all hierarchy levels. The filtering behaves according to the following logic:

If a parent node matches the filter, we display:

  • The parent node
  • All of its children, regardless of whether the children themselves match the filter

If a parent node does not match the filter, we still display the parent if any of its children match the filter. In this case, we only show:

  • The parent node
  • Only the child nodes that match the filter

We prepared some illustrations based on the following JSFiddle: https://jsfiddle.net/flexmonster/o4jywt38/. We will use the "not_begin" filter:

1) not_begin: "a" (https://jsfiddle.net/flexmonster/z5t7skb4/)

The expected result:

Accessories
- green
- red
- white
- yellow

In this case, Flexmonster does not hide the Accessories node, since its children do not begin with "a", which matches the filter.

2) not_begin: "r" (https://jsfiddle.net/flexmonster/1em684b5/)

The expected result:

Accessories
- green
- red
- white
- yellow

The red row is not removed since the parent node (Accessories) does not begin with "r".

3) not_begin: "b" (https://jsfiddle.net/flexmonster/pduqez1r/)

Before filters:

Bikes
- blue
- green
- purple
- red
- white
- yellow

The expected result (blue is removed):

Bikes
- green
- purple
- red
- white
- yellow

We display the parent node because of matching children, but only the matching children are shown (all except the blue).

Please let us know if any questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer