Topic: Select returns an array
master@mastersistemas.net pro asked 6 years ago
getSelectAlterar= (value) => { console.log(value); varbancoAlterar=this.state.bancoAlterar; bancoAlterar.nome=value; this.setState({ bancoAlterar:bancoAlterar }); }
<Select getValue={this.getSelectAlterar}> <SelectInputselected={this.state.bancoAlterar.nome}className="select"></SelectInput> <SelectOptions> <SelectOptionicon={brasil}>Banco do Brasil</SelectOption> <SelectOptionicon={caixa}>Caixa</SelectOption> <SelectOptionicon={carteira}>Carteira</SelectOption> <SelectOptionicon={cresol}>Cresol</SelectOption> <SelectOptionicon={viacredi}>Crevisc</SelectOption> <SelectOptionicon={itau}>Itau</SelectOption> <SelectOptionicon={santander}>Santander</SelectOption> <SelectOptionicon={sicred}>Sicred</SelectOption> <SelectOptionicon={sicoob}>Sicoob</SelectOption> <SelectOptionicon={viacredi}>Viacredi</SelectOption> <SelectOptionicon={outros}>Outros</SelectOption> </SelectOptions> </Select>
Mikołaj Smoleński staff answered 6 years ago
master@mastersistemas.net pro answered 6 years ago
this.state = { bancoAlterar:{agencia:"",ativo:0,ativodesc:"",codigo:"",conta:"",dv:"",id:0,nome:"",saldo:""}, } getSelectAlterar = (Value) => { var bancoAlterar =this.state.bancoAlterar; bancoAlterar.nome =Value[0]; console.log(Value[0]); this.setState({ bancoAlterar: bancoAlterar }); } <Select getValue={this.getSelectAlterar}> <SelectInput selected={this.state.bancoAlterar.nome}className="select"></SelectInput>
<SelectOptions> <SelectOption icon={brasil}>Banco do Brasil</SelectOption> <SelectOption icon={caixa}>Caixa</SelectOption> <SelectOption icon={carteira}>Carteira</SelectOption> <SelectOption icon={cresol}>Cresol</SelectOption> <SelectOption icon={viacredi}>Crevisc</SelectOption> <SelectOption icon={itau}>Itau</SelectOption> <SelectOption icon={santander}>Santander</SelectOption> <SelectOption icon={sicred}>Sicred</SelectOption> <SelectOption icon={sicoob}>Sicoob</SelectOption> <SelectOption icon={viacredi}>Viacredi</SelectOption> <SelectOption icon={outros}>Outros</SelectOption> </SelectOptions> </Select>
Mikołaj Smoleński staff answered 6 years ago
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- ForumUser: Pro
- Premium support: No
- Technology: MDB React
- MDB Version: 4.7.0
- Device: Desktop
- Browser: All
- OS: All
- Provided sample code: Yes
- Provided link: No