Handsontable example
HTML
<div id="example3" class="hot"></div>
CSS
.controllers {
width: 200px;
float: left;
}
.controllers input[type=checkbox] {
margin-left: 5px;
margin-right: 5px;
}
</style><!-- Ugly Hack due to jsFiddle issue -->
<script src="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@7.4.2/dist/handsontable.full.min.css">
<script src="https://handsontable.com/docs/7.4.2/scripts/jsfiddle-fixer.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react@16/umd/react.development.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@handsontable/react@3.1.2/dist/react-handsontable.js"></script>
Babel + JSX
import React from 'react';
import ReactDOM from 'react-dom';
import { HotTable } from '@handsontable/react';
import Handsontable from 'handsontable';
class LoaderWithButton extends React.Component {
constructor(props) {
super(props);
}
render() {
console.log(this.props);
if (this.props.show) {
return <div className='d-inline-block text-center' style={{position: 'absolute',left: '50%',top: '50%',"WebkitTransform": 'translate(-50%, -50%)',transform: 'translate(-50%, -50%)',zIndex:1}}>
<div className='a-loading a-primary'></div>
<div className='a-mt-10 a-h6 a-text-red' style={{backgroundColor:'white'}}>{this.props.title}</div>
</div>
}
return "";
}
}
class MyComponent extends React.Component {
constructor(props) {
super(props);
MyComponent.__this = this;
this.state = {
isLoaded:true,
title:'Loading... Please wait',
settings: {
data: Handsontable.helper.createSpreadsheetData(32000, 10),
width: 570,
height: 220,
dropdownMenu: ['filter_by_condition', 'filter_by_value', 'filter_action_bar'],
filters: true,
rowHeaders: true,
colHeaders:true,
beforeFilter: function (formulaStacks){
MyComponent.__this.setState({
title:'Applying Filter! please wait...',
isLoaded:false
});
},
afterFilter: function (formulaStacks) {
MyComponent.__this.setState({
title:'Message did not go',
isLoaded:true
});
},
}
}
}
render() {
return (
<div>
<HotTable root="hot" settings={this.state.settings}/>
<LoaderWithButton show={this.state.isLoaded} title={this.state.title}/>
</div>
);
}
}
ReactDOM.render(<MyComponent />,...