pranjal-goswami / multifact-pivottable

A JavaScript plugin for PivotTable.js. It renders multiple aggregations simultaneously with added configurations for rendering beautiful tables http://pranjalgoswami.in/multifact-pivottable/examples/index.html
MIT License
18 stars 13 forks source link

Getting Started With React Steps. #6

Open Ashlesha26shopti opened 4 years ago

Ashlesha26shopti commented 4 years ago

I am new to react. Can you please help me out with how to use this plugin with the react package of pivottable. https://github.com/plotly/react-pivottable.

This is my code: //////////////////////START CODE////////////////////////

import React from 'react'; import ReactDOM from 'react-dom'; import PivotTableUI from 'react-pivottable/PivotTableUI'; import 'react-pivottable/pivottable.css'; import TableRenderers from 'react-pivottable/TableRenderers';

class NewPivotTable extends React.Component { state = { rows: ['name'], cols: ['country'], aggregatorName: 'Sum', vals: ['price'] };

handleChange = s => { this.setState({ rows: s.rows, cols: s.cols, aggregatorName: s.aggregatorName, vals: s.vals }); };

render() { return ( <div style={{ width: '100%', height: '500px', overflowY: 'auto', overflowX: 'auto' }}> <PivotTableUI data={data} rows={this.state.rows} cols={this.state.cols} aggregatorName={this.state.aggregatorName} renderers={Object.assign({}, TableRenderers)} vals={this.state.vals} onChange={s => this.handleChange(s)} />

); } }

export default NewPivotTable;

////END CODE////// Can you help me out with how can I add this plugin with my code. It will be of great help. I have installed your plugin using npm i multifact-pivottable