-1

Tell me please, how can I set defaultValue in Multiple Search Selection Dropdown? I tried to set array of object like discribe in docs, but I do not receive what I want

constructor(props) {
  super(props);

  this.state = {
     specs: [],
     doctorSpecs: []
  }

  this.profileService = new ProfileService();
  this.addSpecializationsService = new SpecializatoinsService();
}

componentWillMount() {
 this.profileService.getProfileInformation()
  .then((res) => {
   this.setState({
    profile: res.data,
    consultationFees: res.data.consultation_fees,
    mpdbRegistrationNumber: res.data.mpdb_registration_number,
    qualification: res.data.qualification,
    experienceYears: res.data.experience_years,
    doctorSpecs: res.data.specializations.map((elem, index) => {
      return {key: index, value: elem.id, text: elem.name}
    })
  })
})

this.addSpecializationsService.getSpecializationsList("", (res) => {
  console.log(res);
  this.setState({
     specs: res.data.body.map((elem, index) => {
       return {key: elem.id, value: elem.id, text: elem.name}
     })
   })
 });
} 

// other nessesary code

// component where must be this.state.doctorSpecs
<Dropdown 
    className='profile-specs'
    placeholder='Skills' 
    fluid multiple selection search 
    options={this.state.specs} 
    onChange={this._onChangeSpecs}
    value={this.state.doctorSpecs}
    onSearchChange={this._getListSpecs}/>

I want , after render component, display array of values in this dropdown I tried to use value, defaultValue, but it's not work

1 Answers1

0

I find a problem. I had to transfer to the array not objects, but text values from this objects