diff --git a/frontend/src/visualizations/Table.jsx b/frontend/src/visualizations/Table.jsx index fe77adc27c5b26a660bdc82dd62e4c0494a3b078..3d7a4e3ad4843b881060e8cfb4c99aab58f2da3c 100644 --- a/frontend/src/visualizations/Table.jsx +++ b/frontend/src/visualizations/Table.jsx @@ -35,6 +35,7 @@ export default class Bar extends Component { } componentWillReceiveProps(newProps) { + // TODO: remove use of deprecated "card" and "data" props if (newProps.data !== this.state.rawData && newProps.data) { // check if the data is pivotable (2 groupings + 1 agg != 'rows') const isPivoted = !!( diff --git a/frontend/src/visualizations/TableSimple.jsx b/frontend/src/visualizations/TableSimple.jsx index bb96cc928f3c9d9cdf7ec97eb9ccc42a20397ec9..111813453a5f3bb6b48c0319b7b3eb495670e090 100644 --- a/frontend/src/visualizations/TableSimple.jsx +++ b/frontend/src/visualizations/TableSimple.jsx @@ -45,17 +45,18 @@ export default class TableSimple extends Component { let headerHeight = ReactDOM.findDOMNode(this.refs.header).getBoundingClientRect().height; let footerHeight = this.refs.footer ? ReactDOM.findDOMNode(this.refs.footer).getBoundingClientRect().height : 0; let rowHeight = ReactDOM.findDOMNode(this.refs.firstRow).getBoundingClientRect().height + 1; - let pageSize = Math.floor((this.props.height - headerHeight - footerHeight) / rowHeight) || 1; + let pageSize = Math.max(1, Math.floor((this.props.height - headerHeight - footerHeight) / rowHeight)); + console.log(this.props.height, headerHeight, footerHeight, rowHeight) if (this.state.pageSize !== pageSize) { this.setState({ pageSize }); } } render() { - const { series } = this.props; + const { data } = this.props; const { page, pageSize, sortColumn, sortDescending } = this.state; - let { rows, cols } = series[0].data; + let { rows, cols } = data; let start = pageSize * page; let end = Math.min(rows.length - 1, pageSize * (page + 1) - 1);