Skip to content

Commit 94f5d84

Browse files
committed
exampple for #892
1 parent dbc40d3 commit 94f5d84

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

examples/js/style/demo.js

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import TrClassStringTable from './tr-class-string-table';
55
import TrClassFunctionTable from './tr-class-function-table';
66
import TdClassStringTable from './td-class-string-table';
77
import TdClassFunctionTable from './td-class-function-table';
8+
import EditTdClassTable from './edit-td-class-table';
89
import InlineStylingTable from './inline-style-table';
910
import TableClassTable from './table-class-table';
1011

@@ -57,6 +58,15 @@ class Demo extends React.Component {
5758
</div>
5859
</div>
5960
</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 &lt;TableHeaderColumn&gt;</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>
6070
<div className='col-md-offset-1 col-md-8'>
6171
<div className='panel panel-default'>
6272
<div className='panel-heading'>Support Inline Style for Bootstrap Table</div>
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
}

examples/js/style/style.css

+4
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@
4545
.my-table-container-class {
4646
border: #FFBB73 5px solid;
4747
}
48+
49+
.class-for-editing-cell {
50+
background-color: #FFBB73;
51+
}

0 commit comments

Comments
 (0)