Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Created February 13, 2017 15:22
Show Gist options
  • Select an option

  • Save AllenFang/2742dad5f2750e025b3383b77be10d30 to your computer and use it in GitHub Desktop.

Select an option

Save AllenFang/2742dad5f2750e025b3383b77be10d30 to your computer and use it in GitHub Desktop.
class FullyCustomSizePerPageDropDown extends React.Component {
constructor(props) {
super(props);
}
renderSizePerPageDropDown = props => {
return (
<div className='btn-group'>
{
[ 10, 25, 30 ].map((n, idx) => {
const isActive = (n === props.currSizePerPage) ? 'active' : null;
return (
<button key={ idx } type='button' className={ `btn btn-info ${isActive}` } onClick={ () => props.changeSizePerPage(n) }>{ n }</button>
);
})
}
</div>
);
}
render() {
const options = {
sizePerPageDropDown: this.renderSizePerPageDropDown
};
return (
<div>
<BootstrapTable
data={ products }
options={ options }
pagination>
<TableHeaderColumn dataField='id' isKey>Product ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
<TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
</BootstrapTable>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment