Skip to content

Commit 94b4451

Browse files
committed
fix #1009
1 parent f3b324d commit 94b4451

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

src/BootstrapTable.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ class BootstrapTable extends Component {
167167
export: column.props.export,
168168
expandable: column.props.expandable,
169169
index: i,
170-
attrs: column.props.tdAttr
170+
attrs: column.props.tdAttr,
171+
style: column.props.tdStyle
171172
};
172173
}
173174
});

src/TableBody.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ class TableBody extends Component {
106106
onEdit={ this.handleEditCell }
107107
width={ column.width }
108108
onClick={ this.handleClickCell }
109-
attrs={ column.attrs }>
109+
attrs={ column.attrs }
110+
style={ column.style }>
110111
{ columnChild }
111112
</TableColumn>
112113
);

src/TableColumn.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ class TableColumn extends Component {
7676
dataAlign,
7777
hidden,
7878
cellEdit,
79-
attrs
79+
attrs,
80+
style
8081
} = this.props;
8182

8283
const tdStyle = {
8384
textAlign: dataAlign,
84-
display: hidden ? 'none' : null
85+
display: hidden ? 'none' : null,
86+
...style
8587
};
8688

8789
const opts = {};
@@ -113,7 +115,8 @@ TableColumn.propTypes = {
113115
columnTitle: PropTypes.string,
114116
children: PropTypes.node,
115117
onClick: PropTypes.func,
116-
attrs: PropTypes.object
118+
attrs: PropTypes.object,
119+
style: PropTypes.object
117120
};
118121

119122
TableColumn.defaultProps = {

src/TableHeaderColumn.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ class TableHeaderColumn extends Component {
9696
children,
9797
caretRender,
9898
className,
99-
isOnlyHead
99+
isOnlyHead,
100+
thStyle: style
100101
} = this.props;
101102
const thStyle = {
102103
textAlign: headerAlign || dataAlign,
103-
display: hidden ? 'none' : null
104+
display: hidden ? 'none' : null,
105+
...style
104106
};
105107
if (!isOnlyHead) {
106108
if (sortIndicator) {
@@ -259,7 +261,9 @@ TableHeaderColumn.propTypes = {
259261
sortIndicator: PropTypes.bool,
260262
export: PropTypes.bool,
261263
expandable: PropTypes.bool,
262-
tdAttr: PropTypes.object
264+
tdAttr: PropTypes.object,
265+
tdStyle: PropTypes.Object,
266+
thStyle: PropTypes.Object
263267
};
264268

265269
TableHeaderColumn.defaultProps = {
@@ -291,7 +295,9 @@ TableHeaderColumn.defaultProps = {
291295
filter: undefined,
292296
sortIndicator: true,
293297
expandable: true,
294-
tdAttr: undefined
298+
tdAttr: undefined,
299+
tdStyle: undefined,
300+
thStyle: undefined
295301
};
296302

297303
export default TableHeaderColumn;

0 commit comments

Comments
 (0)