We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

(bug?) getFilter member uses hierarchyCaption rather than hierarchyUniqueName if caption is defined

Answered
Michael T asked on May 23, 2022

When Caption is defined, the getFilter / setFilter members array seems to require using the caption
hierarchyCaption.[value]
rather than
hierarchyUniqueName.[value] 
Keeping it as uniqueName whether or not caption is not set would make more sense...
 
(Either way, it's also not clear in your documentation what should be used. can you make it more explicit?)
e.g. https://www.flexmonster.com/api/getfilter/
 
It appears also that if there is only one member of a hierarchy, then getFilter will return null no matter what. Also would be good to document that if that is true.
 
Thank you

4 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster May 25, 2022

Hello, Michael!

Thank you for reaching out to us.

About getFilter/setFilter behavior
We appreciate your mentioning that it may be unclear that you should use the uniqueName instead of the caption. We have already updated our getFilter/setFilter documentation.

Please note that Flexmonster is using the hierarchies uniqueName inside of getFilter/setFilter methods. Please see this JSFiddle example, where getFilter(uniqueName) returns applied filter while getFilter(caption) returns null: https://jsfiddle.net/flexmonster/3Lgpu5yb/.

In case of hierarchy with one member, the getFilter returns null
We want to explain that this behavior exists because, in the case of the field with one member, there can be two filtering options:

  1. Selecting this single member, which is equivalent to a situation when no filter is applied.
  2. Deselecting this only member is prohibited. For illustration, please see this example: https://jsfiddle.net/flexmonster/bqa7zpo1/. It contains the members filter with no members. However, Flexmonster will still display the member on the grid.

As a result, the getFilter always returns null on members filter as there are no available filtering options. But you can still use the query filter, and the getFilter API call will return it.

Feel free to ask if any further questions arise.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 1, 2022

Hello, Michael!

Hope you are doing well.
We would like to know if we successfully addressed your question and clarified both points about getFilter/setFilter API calls.

Best Regards,
Maksym

Public
Michael T June 15, 2022

You've made it more clear that one member won't show anything on getFilter, but it may benefit your users to document the behaviour on your documentation pages.  https://www.flexmonster.com/api/getfilter/ 
thank you

Public
Maksym Diachenko Maksym Diachenko Flexmonster June 15, 2022

Hello, Michael!

Thank you for your feedback.
Our team will consider the idea of documenting the described behavior of the getFilter API call.

Best Regards,
Maksym

Please login or Register to Submit Answer