How to eliminate duplicate values in dropdown of a React Table - ReactJS/JavaScript












-2















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.



Duplicate values in Dropdown. As you can see Sam is coming twice.



Screenshot 2. 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.










share|improve this question

























  • You're asking how to remove duplicates from a collection in JavaScript?

    – Dave Newton
    Jan 2 at 18:42











  • @Dave Newton Basically I am not aware of Collection. 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.

    – tommy123
    Jan 2 at 18:45











  • Collection (noun): a group of things or people. My point is that you're basically asking how to filter a collection, which is covered all over the place.

    – Dave Newton
    Jan 2 at 21:05
















-2















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.



Duplicate values in Dropdown. As you can see Sam is coming twice.



Screenshot 2. 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.










share|improve this question

























  • You're asking how to remove duplicates from a collection in JavaScript?

    – Dave Newton
    Jan 2 at 18:42











  • @Dave Newton Basically I am not aware of Collection. 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.

    – tommy123
    Jan 2 at 18:45











  • Collection (noun): a group of things or people. My point is that you're basically asking how to filter a collection, which is covered all over the place.

    – Dave Newton
    Jan 2 at 21:05














-2












-2








-2








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.



Duplicate values in Dropdown. As you can see Sam is coming twice.



Screenshot 2. 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.










share|improve this question
















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.



Duplicate values in Dropdown. As you can see Sam is coming twice.



Screenshot 2. 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.







javascript reactjs react-table






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 19:03







tommy123

















asked Jan 2 at 18:34









tommy123tommy123

12118




12118













  • You're asking how to remove duplicates from a collection in JavaScript?

    – Dave Newton
    Jan 2 at 18:42











  • @Dave Newton Basically I am not aware of Collection. 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.

    – tommy123
    Jan 2 at 18:45











  • Collection (noun): a group of things or people. My point is that you're basically asking how to filter a collection, which is covered all over the place.

    – Dave Newton
    Jan 2 at 21:05



















  • You're asking how to remove duplicates from a collection in JavaScript?

    – Dave Newton
    Jan 2 at 18:42











  • @Dave Newton Basically I am not aware of Collection. 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.

    – tommy123
    Jan 2 at 18:45











  • Collection (noun): a group of things or people. My point is that you're basically asking how to filter a collection, which is covered all over the place.

    – Dave Newton
    Jan 2 at 21:05

















You're asking how to remove duplicates from a collection in JavaScript?

– Dave Newton
Jan 2 at 18:42





You're asking how to remove duplicates from a collection in JavaScript?

– Dave Newton
Jan 2 at 18:42













@Dave Newton Basically I am not aware of Collection. 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.

– tommy123
Jan 2 at 18:45





@Dave Newton Basically I am not aware of Collection. 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.

– tommy123
Jan 2 at 18:45













Collection (noun): a group of things or people. My point is that you're basically asking how to filter a collection, which is covered all over the place.

– Dave Newton
Jan 2 at 21:05





Collection (noun): a group of things or people. My point is that you're basically asking how to filter a collection, which is covered all over the place.

– Dave Newton
Jan 2 at 21:05












2 Answers
2






active

oldest

votes


















1














var names = this.state.data.map((o, i) => {
return o.firstName
})

var uniqueNames = names.filter(function(i, index){
return names.indexOf(i) >= index
});


https://codesandbox.io/s/40n0jnzk5x
See fix for firstdropdown



Helper function



var uniqueOptions = (objectsArray, objectKey) => {

var a = objectsArray.map((o, i) => {
return o[objectKey]
})

return a.filter(function(i, index){
return a.indexOf(i) >= index
})
}


Usage for first name dropdown (Same for any other dropDown)



      ....
multi={true}
options={this.uniqueOptions(this.state.data, 'firstName').map((name, i) => {
return { id: i, value: name, label: name };
})}
...


Ideally, you would calculate this outside render to prevent recalculation on every render but you get the idea






share|improve this answer


























  • Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

    – tommy123
    Jan 2 at 18:51













  • codesandbox.io/s/40n0jnzk5x

    – varoons
    Jan 2 at 18:54











  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:55











  • Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

    – varoons
    Jan 2 at 18:56











  • Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

    – tommy123
    Jan 2 at 18:59



















1














Try this



const getOptions = propertyName => {
return this.state.data.reduce((accum, elem, i) => {
const accumulator = [...accum];
if (!accumulator.some(e => e.value === elem[propertyName])) {
accumulator.push({
id: i,
value: elem[propertyName],
label: elem[propertyName]
});
}
return accumulator;
}, );
};


getOptions("FirstName")






share|improve this answer


























  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:53











  • Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

    – tommy123
    Jan 2 at 19:10











  • codesandbox.io/s/8nklw2krw8

    – Alejandro Gonzalez
    Jan 2 at 19:14












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011460%2fhow-to-eliminate-duplicate-values-in-dropdown-of-a-react-table-reactjs-javascr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














var names = this.state.data.map((o, i) => {
return o.firstName
})

var uniqueNames = names.filter(function(i, index){
return names.indexOf(i) >= index
});


https://codesandbox.io/s/40n0jnzk5x
See fix for firstdropdown



Helper function



var uniqueOptions = (objectsArray, objectKey) => {

var a = objectsArray.map((o, i) => {
return o[objectKey]
})

return a.filter(function(i, index){
return a.indexOf(i) >= index
})
}


Usage for first name dropdown (Same for any other dropDown)



      ....
multi={true}
options={this.uniqueOptions(this.state.data, 'firstName').map((name, i) => {
return { id: i, value: name, label: name };
})}
...


Ideally, you would calculate this outside render to prevent recalculation on every render but you get the idea






share|improve this answer


























  • Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

    – tommy123
    Jan 2 at 18:51













  • codesandbox.io/s/40n0jnzk5x

    – varoons
    Jan 2 at 18:54











  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:55











  • Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

    – varoons
    Jan 2 at 18:56











  • Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

    – tommy123
    Jan 2 at 18:59
















1














var names = this.state.data.map((o, i) => {
return o.firstName
})

var uniqueNames = names.filter(function(i, index){
return names.indexOf(i) >= index
});


https://codesandbox.io/s/40n0jnzk5x
See fix for firstdropdown



Helper function



var uniqueOptions = (objectsArray, objectKey) => {

var a = objectsArray.map((o, i) => {
return o[objectKey]
})

return a.filter(function(i, index){
return a.indexOf(i) >= index
})
}


Usage for first name dropdown (Same for any other dropDown)



      ....
multi={true}
options={this.uniqueOptions(this.state.data, 'firstName').map((name, i) => {
return { id: i, value: name, label: name };
})}
...


Ideally, you would calculate this outside render to prevent recalculation on every render but you get the idea






share|improve this answer


























  • Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

    – tommy123
    Jan 2 at 18:51













  • codesandbox.io/s/40n0jnzk5x

    – varoons
    Jan 2 at 18:54











  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:55











  • Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

    – varoons
    Jan 2 at 18:56











  • Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

    – tommy123
    Jan 2 at 18:59














1












1








1







var names = this.state.data.map((o, i) => {
return o.firstName
})

var uniqueNames = names.filter(function(i, index){
return names.indexOf(i) >= index
});


https://codesandbox.io/s/40n0jnzk5x
See fix for firstdropdown



Helper function



var uniqueOptions = (objectsArray, objectKey) => {

var a = objectsArray.map((o, i) => {
return o[objectKey]
})

return a.filter(function(i, index){
return a.indexOf(i) >= index
})
}


Usage for first name dropdown (Same for any other dropDown)



      ....
multi={true}
options={this.uniqueOptions(this.state.data, 'firstName').map((name, i) => {
return { id: i, value: name, label: name };
})}
...


Ideally, you would calculate this outside render to prevent recalculation on every render but you get the idea






share|improve this answer















var names = this.state.data.map((o, i) => {
return o.firstName
})

var uniqueNames = names.filter(function(i, index){
return names.indexOf(i) >= index
});


https://codesandbox.io/s/40n0jnzk5x
See fix for firstdropdown



Helper function



var uniqueOptions = (objectsArray, objectKey) => {

var a = objectsArray.map((o, i) => {
return o[objectKey]
})

return a.filter(function(i, index){
return a.indexOf(i) >= index
})
}


Usage for first name dropdown (Same for any other dropDown)



      ....
multi={true}
options={this.uniqueOptions(this.state.data, 'firstName').map((name, i) => {
return { id: i, value: name, label: name };
})}
...


Ideally, you would calculate this outside render to prevent recalculation on every render but you get the idea







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 2 at 19:21

























answered Jan 2 at 18:48









varoonsvaroons

1,301168




1,301168













  • Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

    – tommy123
    Jan 2 at 18:51













  • codesandbox.io/s/40n0jnzk5x

    – varoons
    Jan 2 at 18:54











  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:55











  • Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

    – varoons
    Jan 2 at 18:56











  • Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

    – tommy123
    Jan 2 at 18:59



















  • Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

    – tommy123
    Jan 2 at 18:51













  • codesandbox.io/s/40n0jnzk5x

    – varoons
    Jan 2 at 18:54











  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:55











  • Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

    – varoons
    Jan 2 at 18:56











  • Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

    – tommy123
    Jan 2 at 18:59

















Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

– tommy123
Jan 2 at 18:51







Yes I understand your logic. But how can I use this in my Code. Can you please fork my fiddle and show me. There are two dropdowns. Please update my Sandbox and show how it works in my code. This is my fiddle - codesandbox.io/s/w2wjnz61l5

– tommy123
Jan 2 at 18:51















codesandbox.io/s/40n0jnzk5x

– varoons
Jan 2 at 18:54





codesandbox.io/s/40n0jnzk5x

– varoons
Jan 2 at 18:54













I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

– tommy123
Jan 2 at 18:55





I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

– tommy123
Jan 2 at 18:55













Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

– varoons
Jan 2 at 18:56





Apply the same for last name. You could write a function to address both at the same time but i think this is a more concise solution

– varoons
Jan 2 at 18:56













Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

– tommy123
Jan 2 at 18:59





Can we have a more generalized solution. See I have to basically 2 lines of code for every dropdown. If I have 15 columns have to write this again and again - var names = this.state.data.map((o, i) => { return o.firstName })

– tommy123
Jan 2 at 18:59













1














Try this



const getOptions = propertyName => {
return this.state.data.reduce((accum, elem, i) => {
const accumulator = [...accum];
if (!accumulator.some(e => e.value === elem[propertyName])) {
accumulator.push({
id: i,
value: elem[propertyName],
label: elem[propertyName]
});
}
return accumulator;
}, );
};


getOptions("FirstName")






share|improve this answer


























  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:53











  • Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

    – tommy123
    Jan 2 at 19:10











  • codesandbox.io/s/8nklw2krw8

    – Alejandro Gonzalez
    Jan 2 at 19:14
















1














Try this



const getOptions = propertyName => {
return this.state.data.reduce((accum, elem, i) => {
const accumulator = [...accum];
if (!accumulator.some(e => e.value === elem[propertyName])) {
accumulator.push({
id: i,
value: elem[propertyName],
label: elem[propertyName]
});
}
return accumulator;
}, );
};


getOptions("FirstName")






share|improve this answer


























  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:53











  • Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

    – tommy123
    Jan 2 at 19:10











  • codesandbox.io/s/8nklw2krw8

    – Alejandro Gonzalez
    Jan 2 at 19:14














1












1








1







Try this



const getOptions = propertyName => {
return this.state.data.reduce((accum, elem, i) => {
const accumulator = [...accum];
if (!accumulator.some(e => e.value === elem[propertyName])) {
accumulator.push({
id: i,
value: elem[propertyName],
label: elem[propertyName]
});
}
return accumulator;
}, );
};


getOptions("FirstName")






share|improve this answer















Try this



const getOptions = propertyName => {
return this.state.data.reduce((accum, elem, i) => {
const accumulator = [...accum];
if (!accumulator.some(e => e.value === elem[propertyName])) {
accumulator.push({
id: i,
value: elem[propertyName],
label: elem[propertyName]
});
}
return accumulator;
}, );
};


getOptions("FirstName")







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 2 at 19:04

























answered Jan 2 at 18:51









Alejandro GonzalezAlejandro Gonzalez

2266




2266













  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:53











  • Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

    – tommy123
    Jan 2 at 19:10











  • codesandbox.io/s/8nklw2krw8

    – Alejandro Gonzalez
    Jan 2 at 19:14



















  • I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

    – tommy123
    Jan 2 at 18:53











  • Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

    – tommy123
    Jan 2 at 19:10











  • codesandbox.io/s/8nklw2krw8

    – Alejandro Gonzalez
    Jan 2 at 19:14

















I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

– tommy123
Jan 2 at 18:53





I want a generalized solution that will work for all fields like firstname, lastname. Your solution is only for firstname.

– tommy123
Jan 2 at 18:53













Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

– tommy123
Jan 2 at 19:10





Can you please fork the fiddle and show me? Basically I want to have this for all columns. Kindly update the Fiddle/Sandbox and show how it works in my code. This is the fiddle -codesandbox.io/s/yvpq6lx4j1

– tommy123
Jan 2 at 19:10













codesandbox.io/s/8nklw2krw8

– Alejandro Gonzalez
Jan 2 at 19:14





codesandbox.io/s/8nklw2krw8

– Alejandro Gonzalez
Jan 2 at 19:14


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011460%2fhow-to-eliminate-duplicate-values-in-dropdown-of-a-react-table-reactjs-javascr%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

Npm cannot find a required file even through it is in the searched directory