Automatically clear out selections in dropdown menu after webpage is loaded

Tags: #<Tag:0x00007f0b0fdb1138>

This is just a duplicate of this thread: Filter by Value bug and UX flaw

However I am confused as to how much of the following snippet: Snippet
I need to copy and where to put it into my JS file. Any help would be greatly appreciated.

Hi @stevenlam505

Do you mean that you would like to have ‘Copy’ in your dropdown menu? If so, what other options do you need besides Copy and Filters?

I worded that poorly, I wanted to know what part of that code snippet I need to copy in order to clear out the selections when the dropdown menu is created. I know I need to copy line 31 but I am not sure if I need to copy the rest of the code after line 31.

You only need to attach this hook logic

 afterDropdownMenuShow(instance) {
    	var filters = instance.hot.getPlugin('filters');
			console.log(filters.valueComponent)
  		filters.components.get('filter_by_value').elements[0].onClearAllClick({preventDefault: function() {}});
    }
1 Like

Thank you for the help, that fixed my issue. Feel free to close this request.

I’m glad to hear that. Thank you for the update.