Skip to content
Snippets Groups Projects
Commit 8f7ce1a4 authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix table card pivoting by reverting to using deprecated 'data' prop for now

parent 95934148
No related branches found
No related tags found
No related merge requests found
......@@ -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 = !!(
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment