Last active
March 13, 2020 20:02
-
-
Save parties/a67c75c2ccc5ee6fe48a to your computer and use it in GitHub Desktop.
Revisions
-
parties renamed this gist
Mar 13, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
parties renamed this gist
Mar 13, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
parties revised this gist
Jun 4, 2015 . 1 changed file with 1 addition and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,13 +49,8 @@ var FittedTable = React.createClass({ }, render() { return ( <div className="fitted-wrapper"> <Table {...this.props} width={this.state.tableWidth} height={this.state.tableHeight}> {this.props.children} </Table> -
parties created this gist
Jun 4, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ var React = require('react'); var {Table} = require('fixed-data-table'); var _ = require('lodash'); var FittedTable = React.createClass({ getInitialState() { return { tableWidth : 400, tableHeight : 400 }; }, componentDidMount() { var win = window; if (win.addEventListener) { win.addEventListener('resize', _.throttle(this._update, 250), false); } else if (win.attachEvent) { win.attachEvent('onresize', _.throttle(this._update, 250)); } else { win.onresize = this._update; } this._update(); }, componentWillReceiveProps(props) { this._update(); }, componentWillUnmount() { var win = window; if(win.removeEventListener) { win.removeEventListener('resize', _.throttle(this._update, 250), false); } else if(win.removeEvent) { win.removeEvent('onresize', _.throttle(this._update, 250), false); } else { win.onresize = null; } }, _update() { if (this.isMounted()) { var node = this.getDOMNode(); this.setState({ tableWidth : node.clientWidth, tableHeight : node.clientHeight }); } }, render() { let inline = {} if(this.props.maxHeight) { inline.maxHeight = this.props.maxHeight; } return ( <div className="fitted-wrapper" style={inline}> <Table {...this.props} width={this.state.tableWidth} height={this.state.tableHeight}> {this.props.children} </Table> </div> ); }, }); module.exports = FittedTable;