Topic: Need controlled Select component of React
shilu911 pro asked 6 years ago
Mikołaj Smoleński staff answered 6 years ago
shilu911 pro commented 6 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 6 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
- ForumUser: Pro
- Premium support: No
- Technology: MDB React
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No