React Data Grid
Performance issues with lots of columns
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.js"></script>
<script src="https://npmcdn.com/react@latest/dist/react-with-addons.js"></script>
<script src="https://npmcdn.com/react-dom@latest/dist/react-dom.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js"></script>
<script type="text/javascript" src="https://npmcdn.com/react-data-grid/dist/react-data-grid.min.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
CSS
*,:before,:after {
box-sizing: border-box;
}
JavaScript 1.7
const numOfRows = 250;
const numOfCols = 50;
const Example = React.createClass({
getInitialState() {
this.createRows();
this._columns = [];
for(var i=0; i < numOfCols; i++) {
this._columns.push({ key: i.toString(), name: 'Col ' + i });
}
return null;
},
createRows() {
let rows = [];
for (let i = 0; i < numOfRows; i++) {
let rowValues = {};
for(var j=0; j < numOfCols; j++) {
rowValues[j] = (i * numOfCols + j);
}
rows.push(rowValues);
}
this._rows = rows;
},
rowGetter(i) {
return this._rows[i];
},
render() {
return (
<ReactDataGrid
columns={this._columns}
rowGetter={this.rowGetter}
rowsCount={this._rows.length}
minHeight={500} />);
}
});
ReactDOM.render(
<Example />,
document.getElementById('container')
);