DropUp instead of dropdown in Pagination
When the pagination toolbar is at the bottom of the screen, the 'sizePerPageList' dropdown is hidden from the viewport.
You can override the styling for the dropdown yourself:
.react-bs-table-pagination .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 2px;
}
Would it be possible to make the css class of the dropdown configurable, either dropdown or dropup?
you can customize it, check https://github.com/AllenFang/react-bootstrap-table/blob/master/examples/js/custom/pagination/custom-size-per-page.js#L39
please upgrade to v3.0.0 to have the customization for all of the table.
let me know if you got any questions, thanks
Hi @AllenFang , there are some problems about the pagination button in my program.
From your documentation, I followed your examples. The page looks good, however it does't pop up options when I clicked on it, even the process did go in to the onToggleDropDown method.
and my code is:
import { BootstrapTable, TableHeaderColumn, SizePerPageDropDown} from 'react-bootstrap-table';
...
onToggleDropDown = (toggleDropDown) => {
console.log('toggle dropdown');
toggleDropDown();
}
renderSizePerPageDropDown = (props) => {
return (
<SizePerPageDropDown
className = 'my-size-per-page'
btnContextual='btn-warning'
variation='dropup'
onClick={() => this.onToggleDropDown(props.toggleDropDown)}
/>
)
}
options = {
// paginationPosition:"top",
paginationShowsTotal: this.renderPaginationShowsTotal,
sizePerPageList: [10, 30, 50, 60],
sizePerPage: 10,
sizePerPageDropDown: this.renderSizePerPageDropDown,
exportCSVBtn: this.createCustomExportCSVButton,
}
...
render() {
return (
<BootstrapTable data={this.state.dataArr} striped hover search
exportCSV condensed pagination options={this.options}>
.........
</BootstrapTable>
)}
On the browser side, I can see there are some styling changing in the new pagination button:

and I can click in the onToggleDropDown method:

The versions of those libs are:
react: '15.3.0'
react-dom : '15.2.1
react-bootstrap-table: '3.3.0',
react-bootstrap: '0.31.0',
bootstrap: '3.3.7'
Any advises about it? Thank you so much.
I think you have to pass the other props as parameters to <SizePerPageDropDown ... />, i.e.
return (
<SizePerPageDropDown
variation='dropup'
{...props}
/>
);
@XidongHuang, I can not reproduce it, how about remove the bootstrap or react-bootstrap dependency and try again?
Also, thanks @stephanebarbey's answer, but I think we dont need to pass the props for this case :)
hmmm. this was my workaround for @XidongHuang 's problem... (I had the same.) If I don't pass the props, when calling renderSizePerPageDropDown(...), the property open:true is not given to <SizePerPageDropDown ...>, which interprets that the dropdown is to remain closed, thus
The page looks good, however it does't pop up options when I clicked on it, even the process did go in to the onToggleDropDown method
but this is on my machine...
Thanks @stephanebarbey and @AllenFang !
The way @stephanebarbey said above works, it does't need remove bootstrap or react-bootstrap, but need to add {...props} in the button <SizePerPageDropDown ... />.
I guess this problem is still about some changes in new react versions.
Anyway, thanks you both again!
Really? it's kind of wired I think. what's the react version you guys use?
@AllenFang The latest one 15.5.4 will throw an Error
ERROR in ./~/react-modal/~/react-dom/index.js
Module not found: Error: Can't resolve 'react/lib/ReactDOM'
if I try import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
So now I am using
react: '15.3.0'
react-dom : '15.2.1
I use
"react": "15.4.2",
"react-addons-update": "15.4.2",
"react-bootstrap": "0.31.0",
"react-bootstrap-table": "3.3.0",
"react-datetime": "2.8.10",
"react-dnd": "2.2.4",
"react-dnd-html5-backend": "2.2.4",
"react-dom": "15.4.2",
"react-flexbox-grid": "1.0.2",
"react-immutable-proptypes": "2.1.0",
"react-interpolate-component": "0.10.0",
"react-loader-advanced": "1.4.1",
"react-notification-system": "0.2.13",
"react-overlays": "0.7.0",
"react-redux": "5.0.3",
"react-router": "2.8.1",
"react-router-bootstrap": "0.23.1",
"react-router-redux": "4.0.8",
"react-scroll": "1.4.7",
"react-select": "1.0.0-rc.3",
"react-textarea-autosize": "4.3.0",
"react-translate-component": "0.13.2",
"redux": "3.6.0",
"redux-api-middleware": "1.0.3",
"redux-thunk": "2.2.0"
ok, seems like i use the same version with you guy but it still work for me ;P Anyway, thanks your solution, if there's still have the same issue, I'll mention this solution, thanks a lots
I confirm the above solution. I have the same issue and when adding add {...props} in the button <SizePerPageDropDown ... />. it was solved :)
That solution works, but produces the following warning for me:
Failed prop type: Invalid prop `currSizePerPage` of type `number` supplied to `SizePerPageDropDown`, expected `string`.
So I used the following workaround:
sizePerPageDropDown: props => <SizePerPageDropDown variation='dropup'
{...props}
currSizePerPage={ '' + props.currSizePerPage } />
So, @AllenFang, why currSizePerPage is a string here:
https://github.com/AllenFang/react-bootstrap-table/blob/22727e29d288a8efabc1700063de19ddc92990fe/src/pagination/SizePerPageDropDown.js#L46
shouldn't it be a number instead?
btw thx for the awesome library)
@alekseyl1992, I think is a little bug that I forgot to convert to String for customization for sizePerPageDropDown, I'll fix it soon
@alekseyl1992, fixed on newest version.
Yes, I confirm - it's fixed. thanks!
Hey @AllenFang How do you user onCellEdit with dropdowns? I am trying to save the table the moment the dropdown is updated
Also, How do I increase the cell size?