How to apply filters condition stack on table load?

Tags: #<Tag:0x00007fd2cf542118>

Hi,

I’m able to get the condition stack via afterInit hook, and
I have tried to apply the filters condition stack on load of the handsontable,

but the filter conditions not applied, I have tried below code, and please find the jsfiddle link which i have tried.

dropdownMenu: [‘filter_by_value’, ‘filter_action_bar’],
filters: true,

beforeInit(){
var hot = this.getInstance();
console.log(filterCondition);
const filtersPlugin = hot.getPlugin(‘filters’);
filtersPlugin.addCondition(1, ‘by_value’, [true], ‘conjunction’);
filtersPlugin.filter();
},

https://jsfiddle.net/prabuk/vbuw7zyd/4/

Kindly help how can we achieve this.,

Hey @prabu.kuppusamy

sorry, but I cannot check the JSFiddle (they’re having some issue and I get 502 once I open the link) but… the conditions are listed here https://handsontable.com/docs/7.2.2/Filters.html#addCondition

Going a bit lower we get

const filtersPlugin = hot.getPlugin('filters');
// add filter "Greater than" 95 to column at index 1
filtersPlugin.addCondition(1, 'by_value', [['ing', 'ed', 'as', 'on']]);
filtersPlugin.filter();

We are using the HandsonTable with Angular wrapper, and in our approach, we couldn’t get the handsontable instance outside of the table settings,

Is there way to apply the filter config in any hook events like afterInit() ?

Kindly look into this example, which i couldn’t even enable the filter option.

Kindly suggest, What I’m doing wrong in that code.

We are facing lot of issues, currently I’m trying to apply the filter condition stack in afterInit() hook, but it is working for only one column, if I tried to add one more column’s filter condition stack, not working,

Kindly suggest which hook should I use?

and If I try to filter again after default filter applied, the filter is not working,

Can we get working example for the below scenario?

On the table load, we need to apply Filter’s Condition Stack.

Thank you
Prabu Kuppusamy

Hi,

The example you’ve attached is using ng2-handsontable. We’re not familiar with this package since we’re not the authors. You should contact them or I can recommend using our Angular wrapper: https://handsontable.com/docs/angular

And we have a guide how to get the Handsontable instance
https://handsontable.com/docs/7.2.2/frameworks-wrapper-for-angular-hot-reference.html

Kind regards,
Wojciech