File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ /* eslint max-len: 0 */
2+ import React from 'react' ;
3+ import { BootstrapTable , TableHeaderColumn } from 'react-bootstrap-table' ;
4+
5+
6+ const products = [ ] ;
7+
8+ function addProducts ( quantity ) {
9+ const startId = products . length ;
10+ for ( let i = 0 ; i < quantity ; i ++ ) {
11+ const id = startId + i ;
12+ products . push ( {
13+ id : id ,
14+ name : 'Item name ' + id ,
15+ price : 2100 + i
16+ } ) ;
17+ }
18+ }
19+
20+ addProducts ( 5 ) ;
21+
22+ export default class CleanSortedTable extends React . Component {
23+
24+ cleanSort = ( ) => {
25+ this . refs . table . cleanSort ( ) ;
26+ }
27+
28+ render ( ) {
29+ return (
30+ < div >
31+ < button className = 'btn btn-default' onClick = { this . cleanSort } > Clean Sort</ button >
32+ < BootstrapTable ref = 'table' data = { products } >
33+ < TableHeaderColumn dataField = 'id' isKey dataSort > Product ID</ TableHeaderColumn >
34+ < TableHeaderColumn dataField = 'name' dataSort > Product Name</ TableHeaderColumn >
35+ < TableHeaderColumn dataField = 'price' > Product Price</ TableHeaderColumn >
36+ </ BootstrapTable >
37+ </ div >
38+ ) ;
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import DisableSortIndicatorTable from './disable-sort-indicator-table';
1212import CustomCaretSortTable from './custom-caret-sort-table' ;
1313import ExternalMultiSort from './manage-multi-sort-external-table' ;
1414import DefaultASCSortTable from './default-asc-sort-table' ;
15+ import CleanSortedTable from './clean-sorted-table' ;
1516
1617class Demo extends React . Component {
1718 render ( ) {
@@ -125,6 +126,15 @@ class Demo extends React.Component {
125126 </ div >
126127 </ div >
127128 </ div >
129+ < div className = 'col-md-offset-1 col-md-8' >
130+ < div className = 'panel panel-default' >
131+ < div className = 'panel-heading' > Clean Sorted Table</ div >
132+ < div className = 'panel-body' >
133+ < h5 > Source in /examples/js/sort/clean-sorted-table.js</ h5 >
134+ < CleanSortedTable />
135+ </ div >
136+ </ div >
137+ </ div >
128138 </ div >
129139 ) ;
130140 }
You can’t perform that action at this time.
0 commit comments