i want to display name and store their id .but i can only pass name
dropdownhandleChange = (e) => {
this.setState({setSelectedValue:Array.isArray(e) ? e.map(x => x.value):null });
}
defaultValue={defaultValueArr}
placeholder={"Select Mates"}
onChange={this.dropdownhandleChange}
options={Dropdownlist.map(e => ({ label: e.Name, value: e.Id}))}
isMulti
/>
var defaultValueArr = [];
Details.map((Det)=>{
Det.profile_name.split(',').map((e)=>{
defaultValueArr.push({label:e,value:e});
});
});

Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 9:02 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 17, 2021, 8:12 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 17, 2021, 8:13 AM EDT
I have used the below values are options in Select component,
export const options = [
{ value: '1', label: 'Chocolate' },
{ value: '2', label: 'Strawberry' },
{ value: '3', label: 'Vanilla' },
{ value: '4', label: 'Ice' },
];
Ganesan CRank #369 · 6.8K reputationPosted Aug 17, 2021, 8:14 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 17, 2021, 9:28 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 17, 2021, 9:47 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 3:01 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 4:38 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 7:00 AM EDT
Is your issue resolved?
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 7:17 AM EDT
No options and values are coming from db.i dont know how to fetch that.your giving const value for that but mine is coming from db
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 7:25 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 7:28 AM EDT
fetch(url, {
method: 'GET',
headers: {
"Content-type": "application/json",
"Accept": "application/json",
},
}).then(response => response.json())
.then(data => {
this.setState({
Details: data
});
});
see i want to display this details in select value
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 7:30 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 7:31 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 7:34 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 7:43 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 8:19 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 8:24 AM EDT
Ganesan CRank #369 · 6.8K reputationPosted Aug 18, 2021, 8:41 AM EDT
selvi jpRank #4,123 · 364 reputationPosted Aug 18, 2021, 8:44 AM EDT
yes right .issue is only passing userid. select label(profilename) to display and storing their id in value(user_id) in edit default value
selvi jpRank #4,123 · 364 reputationPosted Aug 19, 2021, 12:28 AM EDT