Skip to content

Instantly share code, notes, and snippets.

@khanof89
Created June 21, 2018 12:05
Show Gist options
  • Save khanof89/30ae608b647a6acef20cd3af1ba444eb to your computer and use it in GitHub Desktop.
Save khanof89/30ae608b647a6acef20cd3af1ba444eb to your computer and use it in GitHub Desktop.
this is in my inventory.js file
inputFieldOnChangeHandler = (event) => {
this.props.dispatch(updateAvailability(event.target.value, this.props.params.facilityId));
this.props.dispatch(getAvailability(this.props.params.facilityId));
};
<InventoryTableComponent
availabilities={ (this.props.facilities.facility) ? this.props.facilities.facility.data : ''}
dayNames={this.getDays(7)} style={shown}
textInput={(event) => this.inputFieldOnChangeHandler(event)}
/>
* this is my component
const table = (props) => {
return (
<table className="customeTable tableInventory">
<TableHead/>
<tbody className="admin-list-table-body">
{props.dayNames.map((index, value) => {
return (<tr className="rowClickable" key={value}>
<th className="table_head" key={value}>{moment().format('YYYY-MM-DD') === index ? 'Today' : moment(index).format('dddd')}</th>
{[...Array(24).keys()].map((i) => {
return (<td className="tableCells" key={i}>
<input type="text" className="inputBox" value={(props.availabilities) ? props.availabilities[i] : '0'} onChange={props.textInput} defaultValue="0"/>
</td>);
})}
</tr>);
})}
</tbody>
</table>
);
};
export default table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment