Manual filter does not work

Tags: #<Tag:0x00007efc64ff7410>

Hello,

With Handsontable-Pro 1.4.1 I’m trying to have my grid visually filtered on load so that users still have the capacity to remove the filter afterwards.

var example1 = document.getElementById(‘example1’);

var hot = new Handsontable(example1, {
data: [{ col: false }, { col: false }, { col: true }],
colHeaders: [‘Col’],
stretchH: ‘all’,
columnSorting: true,
columns: [{ data: “col”, readOnly: true }],
dropdownMenu: [‘filter_by_condition’, ‘filter_by_value’, ‘filter_action_bar’],
filters: true
});

hot.getPlugin(‘filters’).addFormula(0, ‘eq’, [false]);
hot.getPlugin(‘filters’).filter();

With this sample I can see my formula is added in the dropdownMenu but is not applied.
I tried multiple operators, changing the data type to string and setting the column type to numeric or checkbox but nothing gives.

Then I discovered that it works when I set the instructions in a timer (~3000ms) meaning that manual filter action can only apply after some event has been reached.
My question is then on what event is it okay to execute manual filter actions ?

Thanks and regards,
Eric.

It should be more like this: http://jsfiddle.net/gqz1m8xm/1/ (you have to refer to formulaCollection) but I can see that we’re still getting empty rows instead of only one row with the data.

I’ve added this case to our Github (https://github.com/handsontable/handsontable/issues/3589)

Thanks for sharing @eric.gaspard

Following your sample, I tried some modification but it would not filter (unless I put it in a sufficient time as I explained). I note that you were using a string data whereas I’m using a boolean. I also note that your dropdownMenu is different and I wonder if that can be the cause.

I also added an afterFilter event which is triggered (even when the filter does not occur) and I have this value as the formulaStack parameter of the event.

[{
column: 3,
formulas: [{
name: “eq”,
args: [false]
}]
}]

Thank you for additional information.

Hi @eric.gaspard
Have you tried in with 1.9.0?

Hello, no we did not as we are still on version 1.5.1.

Were there some changes/correction that would help us manually apply a filter?

It looks like a meta data issue but I cannot be sure. I would need to test it more.