Apply a filter to data not mapped to a column?

Tags: #<Tag:0x00007f4527323d18>

As the title says, is there any way to apply a filter based on data that is not directly mapped to a column?

It looks like the Filter API requires setting conditions based on column index. The issue in my scenario is that the data is there, but the column is not. I could create the column for the sake of filtering, but I don’t want to pass it the table to be displayed.

Hi @abeall

We haven’t spoken for a while!

As you mentioned at the moment you would need to add the column to the table to apply a filter.

I think that you could alter the addCondition mention method to inject an external source of data (ref: https://github.com/handsontable/handsontable/blob/fa685dc8c194c0269b893d202580ce7091ed8322/src/plugins/filters/conditionCollection.js#L101) but I guess that it not something you’d like to do.

It has been awhile, good to see you again Aleksandra. :slight_smile:

addCondition is indeed the API I was referring to. It does exactly what I want, except that the first param column expects a numeric index of the visual column. If it could take a data key it would work, but then I can guess the filter logic might depend on some column meta data. If it could take an actual column source config, that’d be perfect. In fact, I already have the column source config, it’s just not supplied to the table (user can configure columns outside HT from a large range of possible columns our app can provide).

Are you suggesting to update the Filters API do one of those things? Sounds like exactly what I want, but I am not sure how much effort would be involved and probably don’t have the bandwidth to do that right now.

@piotr.laszczkowski, can you tell how much effort would be needed to get things working as @abeall mentioned? Are there any possible threats related to replacing the table column index with external data?