Skip to content

Instantly share code, notes, and snippets.

@gustavonecore
Created March 26, 2018 14:29
Show Gist options
  • Save gustavonecore/1bcb318915329e9743f8fcd930b5349a to your computer and use it in GitHub Desktop.
Save gustavonecore/1bcb318915329e9743f8fcd930b5349a to your computer and use it in GitHub Desktop.
components/TransactionRowComponent
import React, { Component } from 'react';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
export default class TransactionRowComponent extends Component {
state = {
value:null,
}
handleChange = (event, index, value) => {
this.setState({value});
this.props.onChangeBusinessCenter(this.props.transactionId, value)
}
render () {
let value = !this.state.value ? this.props.businessCenterId : this.state.value;
return (
<SelectField
value={value}
onChange={this.handleChange}
>
{this.props.businessCenters.map(bc => {
return <MenuItem key={bc.id} value={bc.id} primaryText={bc.name} />
})}
</SelectField>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment