Hi, as far as I know it is not possible to add multiple filters at once on a single flexmonster instance.
Is there any way to apply multiple filters at once (AND filters) on a flexmonster instance.
right now, if I want to apply filter on ‘Column1’, ‘Column2’ and ‘Column3’, I have to do
What I want to do is something like,
fm.setFilter(['Column1', 'Column2', 'Column3'], ['column1.[value1]'], ['column2.[value2]'], ['column3.[value3]'])
If all the filters can’t be applied, I don’t want any one of the filters to be applied. In other words,
I do not want 'Column1' filter OR 'Column2' filter OR 'Column3' filter
I want 'Column1' filter AND 'Column2' filter AND 'Column3' filter.
The only way I can think of achieving this right now is, doing it manually. Apply ‘Column1’ filter and see if it is actually applied by using fm.getFilter() and comparing the members, and then apply ‘Column2’ filter if ‘Column1’ filter is applied properly and so on. If applying any of the filters fail, I remove all the filters.
Is there any possible way to do this right now through Flexmonster API ? Are there any plans to add this sort of functionality in flexmonster in the future ?
Thank you for your question.
You are right. There is no direct way of how this can be achieved, but there is a workaround that you could try using Flexmonster API.
A solution that may be of help is to use the runQuery() method from the API reference. Here is an example of how this can be done:
1) Define a slice variable.
2) In the columns section you can add the desired columns and their filters.
3) When the
flexmonster.runQuery(slice); line is executed, it will apply AND filters to the data.
var slice =
Here is a JSFiddle for a better demonstration.
Before changing the filters, you can save the current slice, then set the filters and check if all filters have applied. If not, then with the
runQuery() method you can roll back to the previous slice (the one which was saved before changing the filters).
Please let us know if this works for you.
That is a brilliant idea. Thank you 🙂