Check if searchable refinementList query is empty or not

Hi!

I’d like to add/remove class to an element whether a searchable refinementList query is empty or not.

For the regular search, I’ve used this:

searchFunction: function(helper) {
if (helper.state.query === ’ ') {
// add class
} else {
// remove class
}
helper.search();
}

I want to do the exact same thing for my searchable refinement lists. Is there a similar solution for this?

Thanks :slight_smile:

Hi @persakarlsson, the query is not available in the refinementList. You may need to save the query in the search so that you can access it in other parts of your code.

Thanks for your answer @cindy.cullen :slight_smile:

I solved it with some JS inside an onRenderHandler. Seems like a working solution.

Would like to learn though, since my programming skills are very limited. Is there something like a CodeSandbox example I could take a look at where something similar/related is being done?