diff --git a/src/components/BTETableComponent.js b/src/components/BTETableComponent.js index 05b2c35..f302627 100644 --- a/src/components/BTETableComponent.js +++ b/src/components/BTETableComponent.js @@ -3,127 +3,60 @@ import React, { Component } from 'react' import { Table, Form, Pagination } from 'semantic-ui-react' export default class BTETable extends Component { - state = { - column: null, - data: [], - display: [], - direction: null, - activePage: 1, - totalPages: 1 - }; - - componentDidUpdate(prevProps) { - // Typical usage (don't forget to compare props): - if (this.props.content !== prevProps.content) { - this.setState({data: this.props.content}) - if (Array.isArray(this.props.content)){ - this.setState({display: this.props.content.slice(0, 10), - totalPages: Math.floor(this.props.content.length/10) + 1}) - } - } - } - - handleSort = (clickedColumn) => () => { - const { column, data, direction } = this.state - - if (column !== clickedColumn) { - this.setState({ - column: clickedColumn, - data: _.sortBy(data, [clickedColumn]), - direction: 'ascending', - }); - - return - } - - this.setState({ - data: data.reverse(), - direction: direction === 'ascending' ? 'descending' : 'ascending', - display: this.state.data.slice(this.state.activePage*10 - 10, this.state.activePage*10), - }); - } - - handlePaginationChange = (e, { activePage }) => { - this.setState({display: this.state.data.slice(activePage*10 - 10, activePage*10), - activePage: activePage}); - } - - render() { - const { column, data, direction } = this.state - + const headers = this.props.table.display.length > 0 ? Object.keys(this.props.table.display[0]) : []; + console.log('header', headers) const formData = () => ( -