Adding external filters to Interaction Manager


#1

Hello, I need to add some filters to the Interaction manager when the user perform some actions using the controls in the UI of my React app, for example when the user clicks on a button in the UI, is there a way to do this in ChartFactor?


#2

Well you can update the filter of the Interaction manager using the updateFilters(filters) function, like this:

async addFilters(filters) {
    const cfApi = cf.getIManager().get('api');
    await cfApi.updateFilters(filters);
}

#3

Great!, It works good, but I have a problem, maybe I didn’t explain myself very well, what I need is for the previous filters to also be deleted, meaning that the new filters are the new Interaction manager state.


#4

I see, well, in that case you have to call two functions, the first one is for set the filters then other function to update the IM content, like this:

const IM = cf.getIManager();
IM.get('api').setFilters(filters, true); // the second parameter is a boolean that indicates the IM if it should clean the stored filters (if any) within the IM before adding the new ones
IM.get('api').updateContent();

#5

This works better for me, thanks for your help