Get Free Trial

Single-Selection for filter dialogs

Answered
Marc Faber asked on July 21, 2021

Hi,
is there a way to set single-selection for dimension filters? I found an option to disable filtering, maybe I’m just missing something. If there is no such setting, how could it be done?
Thanks in advance.

10 answers

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster July 22, 2021

Hi Marc,
 
Thank you for posting your question.
 
Could you please elaborate further on what you’re trying to achieve? What exactly do you mean by “single-selection”?
 
Looking forward to your response.
 
Best regards,
Mykhailo

Public
Marc Faber July 22, 2021

Hi Mykhailo,
Thanks for your reply. I found a selection box in the charts example:
https://jsfiddle.net/flexmonster/08wf6fgL/
I’m referring to “Sum of Orders” where you can select only one option. We would like to have this single-selection behaviour in dimension filters of the grid so we can be sure there is only one item selected for some of the pivot dimensions.
Best regards,
Marc

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster July 22, 2021

Marc,
 
Thank you for the additional explanation.
 
Single-member selection in the filter pop-up window is not natively supported in Flexmonster.
 
That being said, you can try overriding the default filter pop-up behavior with custom code, or simply implement your own filter window. In case you choose the latter, here’s a forum thread where we give suggestions on the implementation: https://www.flexmonster.com/question/filter-requires-two-passes-over-the-data/.
 
Hope this helps!
 
Best regards,
Mykhailo

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster July 29, 2021

Hi Marc,
 
How are you?
 
Have you found our custom filter pop-up suggestions helpful?
 
We’d be happy to hear your feedback.
 
Regards,
Mykhailo

Public
Marc Faber July 29, 2021

Hi Mykhailo,
thanks for your reply. Can you show me how to change the default behaviour of the filter popup dialog? I guess we would like to give this approach a try before eventually going on to writing our own filter window, but don’t know where to start.
Can you give us a hint for this?
Thank you in advance.
Regards,
Marc

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster July 30, 2021

Marc,
 
Thank you for your response.
 
I did mention the approach involving customizing the default filter pop-up, but to be fair, it is not the best solution of the two. Overriding the default filter window means using JavaScript to manipulate the HTML structure at runtime, which might end up being unreliable and unstable. This is also why we do not have any ready-to-use samples for this approach.
 
I’d suggest moving on to implementing your own filter pop-up instead. It is pretty straightforward with the help of the forum thread I’ve mentioned, but please let me know if you run into any trouble – I’ll be happy to help and prepare a reference sample for you.
 
Best regards,
Mykhailo

Public
Marc Faber July 30, 2021

Hi Mykhailo,
in that case we are going for implementing an own filter popup. Can you give me a basic sample for starters which I can build on? I’m on vacation for the upcoming 3 weeks so there is no need to haste, but it would help me a lot to have some basic example for this.
Many thanks to you in advance.
Regards,
Marc

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster August 3, 2021

Hi Marc,
 
I’ve prepared a sample based on the previously mentioned suggestions: https://jsfiddle.net/flexmonster/pvsencqz/. It might require additional customization to suit your specific use case, but I think you get the idea.
 
In the sample, the native filter pop-up is hidden. Instead, when the filteropen event is triggered, a custom pop-up is shown.
 
The hierarchy name for the custom pop-up is received from the filteropen handler, and the hierarchy members to display in the dropdown are retrieved with the getMembers() API call. Once the selected filter is selected through the UI, the setFilter() method is used to apply it to the pivot table. 
 
Please let us know if this helps.
 
Regards,
Mykhailo

Public
Marc Faber August 23, 2021

Hi Mykhailo,
thank you for the example you provided. It seems to me this is exactly what we need for our use case to work. I consider this question solved but would like to keep it open until we have integrated the approach into our environment.
Many thanks to you.
Regards,
Marc

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster August 24, 2021

Hi Marc,
 
Hope you’ve had a great vacation!
 
It is good to hear the suggested approach seems suitable to you.
 
Please feel free to reach out in case you have any updates on this that you’d like to share.
 
Best regards,
Mykhailo

Please login or Register to Submit Answer