I am trying to learn multi filter with React Table. Here is my Demo/Fiddle
I am trying to eliminate duplicate values in dropdown of my React Table
<Select
style={{ width: "50%", marginBottom: "20px" }}
onChange={entry => {
this.setState({ select2: entry });
this.onFilteredChangeCustom(
entry.map(o => {
return o.value;
}),
"firstName"
);
}}
value={this.state.select2}
multi={true}
options={this.state.data.map((o, i) => {
return { id: i, value: o.firstName, label: o.firstName };
})}
/>
I am getting duplicate values in dropdown. Kindly help me how to eliminate the duplicate values in dropdown.
. As you can see Sam is coming twice.
. Jones1 is also coming twice.
Basically I am filtering each column and the above function basically deals with the filtering functionality. Kindly see the screenshot. There is the issue - there are some values which are multiple times in my Json array. But in the dropdown they should come only once.
Edit 1 - I want to a generalized solution which can be applied to any number of dropdowns. Till now I have got two good answers. But both answers are not generalized. I want to extend this unique feature to all columns. I will have 15 to 20 columns. That is why I need a generalized solution.