File tree 3 files changed +50
-0
lines changed
3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import TrClassStringTable from './tr-class-string-table';
5
5
import TrClassFunctionTable from './tr-class-function-table' ;
6
6
import TdClassStringTable from './td-class-string-table' ;
7
7
import TdClassFunctionTable from './td-class-function-table' ;
8
+ import EditTdClassTable from './edit-td-class-table' ;
8
9
import InlineStylingTable from './inline-style-table' ;
9
10
import TableClassTable from './table-class-table' ;
10
11
@@ -57,6 +58,15 @@ class Demo extends React.Component {
57
58
</ div >
58
59
</ div >
59
60
</ div >
61
+ < div className = 'col-md-offset-1 col-md-8' >
62
+ < div className = 'panel panel-default' >
63
+ < div className = 'panel-heading' > Set String or Function to < code > editColumnClassName</ code > on <TableHeaderColumn></ div >
64
+ < div className = 'panel-body' >
65
+ < h5 > Source in /examples/js/style/edit-td-class-table.js</ h5 >
66
+ < EditTdClassTable />
67
+ </ div >
68
+ </ div >
69
+ </ div >
60
70
< div className = 'col-md-offset-1 col-md-8' >
61
71
< div className = 'panel panel-default' >
62
72
< div className = 'panel-heading' > Support Inline Style for Bootstrap Table</ div >
Original file line number Diff line number Diff line change
1
+ /* eslint max-len: 0 */
2
+ /* eslint no-unused-vars: 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 ( 5 ) ;
22
+
23
+ export default class EditColumnClassTable extends React . Component {
24
+ render ( ) {
25
+ const cellEditProps = {
26
+ mode : 'click'
27
+ } ;
28
+ return (
29
+ < BootstrapTable data = { products } cellEdit = { cellEditProps } >
30
+ < TableHeaderColumn dataField = 'id' isKey = { true } > Product ID</ TableHeaderColumn >
31
+ < TableHeaderColumn dataField = 'name' > Product Name</ TableHeaderColumn >
32
+ < TableHeaderColumn dataField = 'price' editColumnClassName = 'class-for-editing-cell' > Product Price</ TableHeaderColumn >
33
+ </ BootstrapTable >
34
+ ) ;
35
+ }
36
+ }
Original file line number Diff line number Diff line change 45
45
.my-table-container-class {
46
46
border : # FFBB73 5px solid;
47
47
}
48
+
49
+ .class-for-editing-cell {
50
+ background-color : # FFBB73 ;
51
+ }
You can’t perform that action at this time.
0 commit comments