Currently, I am having a regex js function that filters the data based on the text entered in the input text, but I want to filter data based on values present in an array. Let say if the array contains 2 values, then it should filter the table for a particular column having either of those values.
function filter_data(Array, column_name, filter_text) {
let data_provider = () => {
const filterRegEx = new RegExp(filter_text, "i");
let filter_value = {};
filter_value[column_name] = filterRegEx;
const filterCriterions = {
op: "$or",
criteria: [
{ op: "$regex", value: filter_value },
],
};
Array = new ArrayDataProvider(Array)
return new ListDataProviderView(Array, { filterCriterion: filterCriterions });
};
return data_provider();
}
The above function, I provide Array Data Provider, column name and filter text as a parameter. Now instead of filter text I want to provide array containing multiple values and filter the table based on those values. Please help me in this approach or specify any other approach that will work in this case.