File tree 2 files changed +48
-0
lines changed
2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 2
2
import React from 'react' ;
3
3
import SingleSelectTable from './single-select-table' ;
4
4
import MultiSelectTable from './multi-select-table' ;
5
+ import UnSelectableTable from './unselectable-table' ;
5
6
import ClickToSelectTable from './click-to-select-table' ;
6
7
import DefaultSelectTable from './default-select-table' ;
7
8
import SelectBgColorTable from './select-bgcolor-table' ;
@@ -34,6 +35,15 @@ class Demo extends React.Component {
34
35
</ div >
35
36
</ div >
36
37
</ div >
38
+ < div className = 'col-md-offset-1 col-md-8' >
39
+ < div className = 'panel panel-default' >
40
+ < div className = 'panel-heading' > UnSelectable Example</ div >
41
+ < div className = 'panel-body' >
42
+ < h5 > Source in /examples/js/selection/unselectable-table.js</ h5 >
43
+ < UnSelectableTable />
44
+ </ div >
45
+ </ div >
46
+ </ div >
37
47
< div className = 'col-md-offset-1 col-md-8' >
38
48
< div className = 'panel panel-default' >
39
49
< div className = 'panel-heading' > Click to Select Row Example</ div >
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
+ const selectRowProp = {
23
+ mode : 'checkbox' ,
24
+ clickToSelect : true ,
25
+ unselectable : [ 1 , 3 , 5 ] // give rowkeys for unselectable row
26
+ } ;
27
+
28
+ export default class UnSelectableTable extends React . Component {
29
+ render ( ) {
30
+ return (
31
+ < BootstrapTable data = { products } selectRow = { selectRowProp } >
32
+ < TableHeaderColumn dataField = 'id' isKey = { true } > Product ID</ TableHeaderColumn >
33
+ < TableHeaderColumn dataField = 'name' > Product Name</ TableHeaderColumn >
34
+ < TableHeaderColumn dataField = 'price' > Product Price</ TableHeaderColumn >
35
+ </ BootstrapTable >
36
+ ) ;
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments