react-bootstrap-table
react-bootstrap-table copied to clipboard
Dynamically adjust height of table?
Hi,
I see that height is a prop right now, so it can't be directly changed.
We have a requirement to change the height of the table dynamically after its rendered.
Would it be possible to expose a setHeight(), perhaps by making height state vs prop?
Thanks!
so according your description, I think the following is not your expectation?
export default class BasicTable extends React.Component {
constructor(props) {
super(props);
this.state = {
height: '120'
};
}
handleHeightChange = () => {
this.setState({
height: '300'
});
}
render() {
return (
<div>
<button onClick={ this.handleHeightChange }>Change height</button>
<BootstrapTable data={ products } height={ this.state.height }>
<TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
</BootstrapTable>
</div>
);
}
}
if right, I can try to expose a setHeight on BootstrapTable :) Hope it's easy to implement :)
Actually, this works fine...sorry for the newb question, and please close.
Thanks!
@Dreculah, that's fine, no worry 👍