Select all filters by default

Tags: #<Tag:0x00007efc656c4e78> #<Tag:0x00007efc656c4d10>

Hello,

When I open the filters dropdown menu, all my values are automatically selected:

image

Is there a way to force the selection of all the values when I click on “Clear” ? Currently when I click on “Clear” the checkboxes are deselected, which results in the user not seeing any data.

Thank you!

Hi @vitorialipan

I have a demo that will work up till v13.1.0 https://jsfiddle.net/3abr5et6/1/

In v14.0.0 the logic changes, so it is no longer available in this option. If you use v14.0.0 please let me know. I will look for a different solution.

Hello,

Thank you for the reply!

I’ve seen this example, but I have some issues with it because:

  1. If I click on Clear and then OK, I see no data, but the behaviour I want is to automatically select all values when I clear my filters (just like Excel, for example)
  2. If I don’t select something and click directly on the “OK” button, the data from the table disappears.

But I have a question regarding this:

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

Can I somehow force the click on “Select all” inside the onClearAllClick hook?

I’m not sure if I understand correctly. The select all is the one that is set by default when we open the menu. The select equals having a checkbox for a value checked and showing it in the end result after filtering. Now, in your case would you rather flip that behavior and use an unchecked checkbox to show a value after filtering?

ps. the opposite to onClearAllClick is onSelectAllClick() method.

Hi,

I’m sorry if my explanation was not clear, I don’t know very well how to express my need so here I will attach a little preview with the behaviour of the filters of Microsoft Excel, which is exactly the desired behaviour I want to have with the filters of Handsontable.

So, at first, yes, the Select All is the default. Then, I filter by a value. Finally, I want to Clear filter. What Excel does, as you can see, is automatically select all the checkboxes from the list when the user clicks on Clear filter. In my Handsontable, if I click on Clear, all the checkboxes are deselected and I have to manually click on "Select All" to select them and see all the data again.

I hope this was more clear. My question was if maybe there is something that can help me replicate this behaviour and force the selection of all the checkboxes when I click on Clear, just like in Excel. Perhaps inside the onClearAllClick method from the example.

Thank you!

I am sorry, but at the moment the filtering UI is not customizable, we cannot change it. that would require to clone the existing plugin and recreate it and that is a lot of work.

Oh, okay. I understand.

Thank you very much for your reply! :blush:
You can now close this topic.

Have a good day!

Thank you. Same for you, @vitorialipan