File tree Expand file tree Collapse file tree 2 files changed +65
-0
lines changed
Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import CustomButtonGroup from './toolbar/custom-button-group';
2626import CustomToolBar1 from './toolbar/custom-toolbar-1' ;
2727import LeftSearchPanel from './toolbar/left-search-panel' ;
2828import CustomSizePerPage from './pagination/custom-size-per-page' ;
29+ import FullyCustomSizePerPage from './pagination/fully-custom-size-per-page' ;
2930import CustomPaginationPanel from './pagination/custom-pagination-panel' ;
3031
3132import { Col , Panel } from 'react-bootstrap' ;
@@ -130,6 +131,10 @@ class Demo extends React.Component {
130131 { renderLinks ( 'custom/pagination/custom-size-per-page.js' ) }
131132 < CustomSizePerPage />
132133 </ Panel >
134+ < Panel header = { 'Fully Custom for Size Per Page DropDown Demo' } >
135+ { renderLinks ( 'custom/pagination/fully-custom-size-per-page.js' ) }
136+ < FullyCustomSizePerPage />
137+ </ Panel >
133138 < Panel header = { 'Custom Pagination Panel Demo' } >
134139 { renderLinks ( 'custom/pagination/custom-pagination-panel.js' ) }
135140 < CustomPaginationPanel />
Original file line number Diff line number Diff line change 1+ /* eslint max-len: 0 */
2+ /* eslint no-console: 0 */
3+ import React from 'react' ;
4+ import { BootstrapTable , TableHeaderColumn } from 'react-bootstrap-table' ;
5+
6+
7+ const products = [ ] ;
8+
9+ function addProducts ( quantity ) {
10+ const startId = products . length ;
11+ for ( let i = 0 ; i < quantity ; i ++ ) {
12+ const id = startId + i ;
13+ products . push ( {
14+ id : id ,
15+ name : 'Item name ' + id ,
16+ price : 2100 + i
17+ } ) ;
18+ }
19+ }
20+
21+ addProducts ( 70 ) ;
22+
23+ export default class FullyCustomSizePerPageDropDown extends React . Component {
24+ constructor ( props ) {
25+ super ( props ) ;
26+ }
27+
28+ renderSizePerPageDropDown = props => {
29+ return (
30+ < div className = 'btn-group' >
31+ {
32+ [ 10 , 25 , 30 ] . map ( n => {
33+ const isActive = ( n === props . currSizePerPage ) ? 'active' : null ;
34+ return (
35+ < button type = 'button' className = { `btn btn-info ${ isActive } ` } onClick = { ( ) => props . changeSizePerPage ( n ) } > { n } </ button >
36+ ) ;
37+ } )
38+ }
39+ </ div >
40+ ) ;
41+ }
42+
43+ render ( ) {
44+ const options = {
45+ sizePerPageDropDown : this . renderSizePerPageDropDown
46+ } ;
47+ return (
48+ < div >
49+ < BootstrapTable
50+ data = { products }
51+ options = { options }
52+ pagination >
53+ < TableHeaderColumn dataField = 'id' isKey = { true } > Product ID</ TableHeaderColumn >
54+ < TableHeaderColumn dataField = 'name' > Product Name</ TableHeaderColumn >
55+ < TableHeaderColumn dataField = 'price' > Product Price</ TableHeaderColumn >
56+ </ BootstrapTable >
57+ </ div >
58+ ) ;
59+ }
60+ }
You can’t perform that action at this time.
0 commit comments