We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a Autocomplete component whoose list an array of MenuItems. When i click in a specific value, only [Object Object] is show.
https://imgur.com/a/lYvEIS5
Here is my code:
class AutoCompleteEspecificacaoItemComponent extends React.Component { constructor(props) { super(props); this.state = { dataSource: [], hover: false, itemHover: '', }; } onChangeDataSource = (value, event) => { const url = this.props.url; let textoAPesquisar = event; if (event.length >= this.props.minimunInputLength) { if (this.props.filtrarSomenteCodigo) { if (this.props.ehPropostaMaterialServico) { textoAPesquisar = formatarNumerosComZerosEsquerda(textoAPesquisar, 8); } else { textoAPesquisar = formatarNumerosComZerosEsquerda(textoAPesquisar, 9); } } axios.get(url, { params: { textoAPesquisar, page: 1, sizePerPage: 15, filtrarPorMaterial: this.props.filtrarPorMaterial, filtrarPorServico: this.props.filtrarPorServico, }, }) .then(({ data: { dados } }) => { const newArr = []; //eslint-disable-next-line dados.map((item) => { let codigoEspecificacao; if (this.props.filtrarSomenteCodigo) { codigoEspecificacao = item.codigo; } else if (this.props.ehPropostaMaterialServico) { codigoEspecificacao = item.nome; } else { codigoEspecificacao = item.especificacao; } const obj = { descricao: codigoEspecificacao, }; newArr.push(obj); }); this.setState({ dataSource: newArr }); }); } }; mouseOver = (event) => { this.setState({ hover: true, itemHover: event.target.textContent, }); }; mouseOut = (event) => { this.setState({ hover: false, itemHover: event.target.textContent, searchText: '', }); }; filtro = (searchText, key) => { if (searchText) return key; return 'Sem resultados'; }; render() { return ( <div style={{ whiteSpace: 'pre-wrap' }}> <Rotulo valor={this.props.rotulo} htmlFor={this.props.id} /> {this.props.textoAjuda && <InfoButton info={this.props.textoAjuda} />} <Field id={this.props.id} name={this.props.name} component={AutoComplete} hintText={this.props.placeholder} openOnFocus onInput={this.props.onInput} filter={this.filtro} menuStyle={{ fontSize: '14px', lineHeight: 'unset', padding: '7px 0px', whiteSpace: 'normal', alignItems: 'center', display: 'inline-flex', minHeight: '28px', width: '100%', }} // dataSource={this.state.dataSource.map(item => item.descricao)} dataSource={this.state.dataSource.map(item => ({ text: item.descricao, value: ( <MenuItem primaryText={item.descricao} style={{ fontSize: '14px', lineHeight: 'unset', padding: '7px 0px', whiteSpace: 'normal', alignItems: 'center', display: 'inline-flex', minHeight: '28px', width: '100%', }} className={this.state.hover && this.state.itemHover === item.descricao ? 'hoverColor' : 'noHoverColor'} onMouseOver={this.mouseOver} onMouseOut={this.mouseOut} /> ), }))} onChange={this.onChangeDataSource} underlineStyle={{ fill: '#000000' }} style={{ marginTop: '-15px' }} listStyle={{ maxHeight: 200, overflow: 'auto', whiteSpace: 'wrap' }} fullWidth /> </div> ); } }
Someone could help me?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a Autocomplete component whoose list an array of MenuItems. When i click in a specific value, only [Object Object] is show.
https://imgur.com/a/lYvEIS5
Here is my code:
Someone could help me?
The text was updated successfully, but these errors were encountered: