Fórum Chamar Actions em um componente .JSX #597345
24/09/2018
0
Amigos, não estou conseguindo comunicar o meu componente .jsx com os meus métodos de Actions.
Importando o arquivo das actions: import * as messageActionCreators from ''./buscaActions'';
Chamando um método: this.props.setListaMatriculasRecibo(row.Matricula, isSelected);
Erro: Uncaught TypeError: Cannot read property ''setListaMatriculasRecibo'' of undefined.
Importando o arquivo das actions: import * as messageActionCreators from ''./buscaActions'';
Chamando um método: this.props.setListaMatriculasRecibo(row.Matricula, isSelected);
Erro: Uncaught TypeError: Cannot read property ''setListaMatriculasRecibo'' of undefined.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | import React, { Component } from ''react''; import { BootstrapTable, TableHeaderColumn, } from ''react-bootstrap-table''; import { connect } from ''react-redux''; import PropTypes from ''prop-types''; import { bindActionCreators } from ''redux''; import * as messageActionCreators from ''./buscaActions''; class gridReciboFerias extends Component { onSelect(row, isSelected) { this.props.setListaMatriculasRecibo(row.Matricula, isSelected); } render() { return ( < div className = "col-md-12" > < BootstrapTable options={this.props.options} data={this.props.lista} selectRow={{ mode: ''checkbox'', bgColor: ''rgb(217, 237, 247)'', onSelect: this.onSelect, //onSelectAll: this.onSelectAll, showOnlySelected: true }} pagination search searchPlaceholder = '' Buscar...'' multiColumnSearch headerStyle={{ background: ''#3174AE'', color: ''white'' }} containerStyle={{ fontSize: ''12px'' }} striped condensed hover > < TableHeaderColumn row = '' 0'' isKey headerAlign = '' center'' dataField = '' Matricula'' className = "text-xs-center" columnClassName = "text-xs-center" width={''30%''} > Matrícula </ TableHeaderColumn > < TableHeaderColumn row = '' 0'' dataField = '' Nome'' className = "text-xs-center" columnClassName = "text-xs-center" width={''50%''} >Nome </ TableHeaderColumn > </ BootstrapTable > </ div > ); } } gridReciboFerias.contextTypes = { router: PropTypes.object }; function mapStateToProps(state) { return { usuario: state.reducers.usuario, reciboFerias: state.reducers.reciboFerias }; } function mapDispatchToProps(dispatch) { return bindActionCreators(messageActionCreators, dispatch); } export default connect(mapStateToProps, mapDispatchToProps)(gridReciboFerias); |

Paulo Amorim
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)