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 CPosted Aug 18, 2021, 1:02 PM
selvi jpPosted Aug 19, 2021, 4:28 AM
selvi jpPosted Aug 18, 2021, 12:44 PM
yes right .issue is only passing userid. select label(profilename) to display and storing their id in value(user_id) in edit default value
Ganesan CPosted Aug 18, 2021, 12:41 PM
selvi jpPosted Aug 18, 2021, 12:24 PM
Ganesan CPosted Aug 18, 2021, 12:19 PM
selvi jpPosted Aug 18, 2021, 11:43 AM
Ganesan CPosted Aug 18, 2021, 11:34 AM
selvi jpPosted Aug 18, 2021, 11:31 AM
Ganesan CPosted Aug 18, 2021, 11:30 AM
selvi jpPosted Aug 18, 2021, 11:28 AM
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 CPosted Aug 18, 2021, 11:25 AM
selvi jpPosted Aug 18, 2021, 11:17 AM
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 CPosted Aug 18, 2021, 11:00 AM
Is your issue resolved?
Ganesan CPosted Aug 18, 2021, 8:38 AM
selvi jpPosted Aug 18, 2021, 7:01 AM
Ganesan CPosted Aug 17, 2021, 1:47 PM
Ganesan CPosted Aug 17, 2021, 1:28 PM
Ganesan CPosted Aug 17, 2021, 12:14 PM
Ganesan CPosted Aug 17, 2021, 12:13 PM
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 CPosted Aug 17, 2021, 12:12 PM