File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-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 ColumnAlignTable extends React . Component {
23
+ render ( ) {
24
+ return (
25
+ < BootstrapTable data = { products } >
26
+ < TableHeaderColumn dataField = 'id' isKey = { true } > Product ID</ TableHeaderColumn >
27
+ < TableHeaderColumn dataField = 'name' columnTitle = { true } > Product Name</ TableHeaderColumn >
28
+ < TableHeaderColumn dataField = 'price' columnTitle = { true } > Product Price</ TableHeaderColumn >
29
+ </ BootstrapTable >
30
+ ) ;
31
+ }
32
+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import React from 'react';
3
3
import ColumnAlignTable from './column-align-table' ;
4
4
import ColumnWidthTable from './column-width-table' ;
5
5
import ColumnHideTable from './column-hide-table' ;
6
+ import ColumnTitleTable from './column-title-table' ;
6
7
7
8
class Demo extends React . Component {
8
9
render ( ) {
@@ -35,6 +36,15 @@ class Demo extends React.Component {
35
36
</ div >
36
37
</ div >
37
38
</ div >
39
+ < div className = 'col-md-offset-1 col-md-8' >
40
+ < div className = 'panel panel-default' >
41
+ < div className = 'panel-heading' > Column Title Example</ div >
42
+ < div className = 'panel-body' >
43
+ < h5 > Source in /examples/js/column/column-title-table.js</ h5 >
44
+ < ColumnTitleTable />
45
+ </ div >
46
+ </ div >
47
+ </ div >
38
48
</ div >
39
49
) ;
40
50
}
You can’t perform that action at this time.
0 commit comments