Topic: Need controlled Select component of React
Mikołaj Smoleński staff answered 7 years ago
shilu911 pro commented 7 years ago
Hello Mikołaj, Thanks for your response, I checked the example, but I don't find a way to pass key-value pair to SelectOption, as well as a default checked attribute. What I want to do is to give a Select component a value when initialize the component. Thank you.Mikołaj Smoleński staff commented 7 years ago
In the code below You can change option values by replacing "Option 1, Option 2...etc.": <SelectOption disabled>Choose your option</SelectOption> <SelectOption triggerOptionClick={this.optionClick}>Option nr 1</SelectOption> <SelectOption triggerOptionClick={this.optionClick}>Option nr 2</SelectOption> <SelectOption triggerOptionClick={this.optionClick}>Option nr 3</SelectOption> <SelectOption triggerOptionClick={this.optionClick}>Option nr 4</SelectOption> <SelectOption triggerOptionClick={this.optionClick}>Option nr 5</SelectOption> Example label Also You can change default values for selects in the following line: this.state = { value: "Choose your option", value2: "Choose your option", value3: "Choose your option", value4: "Choose your option", value5: "Choose your option" } For this moment, that is all we provide to control select. RegardsFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB React
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No