Skip to content

Commit b426974

Browse files
committed
fix #647
1 parent c6d2053 commit b426974

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

src/BootstrapTable.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint no-alert: 0 */
22
/* eslint max-len: 0 */
33
import React, { Component, PropTypes } from 'react';
4+
import classSet from 'classnames';
45
import Const from './Const';
56
import TableHeader from './TableHeader';
67
import TableBody from './TableBody';
@@ -258,13 +259,17 @@ class BootstrapTable extends Component {
258259
let sortIndicator = this.props.options.sortIndicator;
259260
if (typeof this.props.options.sortIndicator === 'undefined') sortIndicator = true;
260261
return (
261-
<div className='react-bs-table-container' style={ this.props.containerStyle }>
262+
<div className={ classSet('react-bs-table-container', this.props.containerClass) }
263+
style={ this.props.containerStyle }>
262264
{ toolBar }
263-
<div className='react-bs-table' ref='table' style={ { ...style, ...this.props.tableStyle } }
265+
<div ref='table'
266+
className={ classSet('react-bs-table', this.props.tableContainerClass) }
267+
style={ { ...style, ...this.props.tableStyle } }
264268
onMouseEnter={ this.handleMouseEnter }
265269
onMouseLeave={ this.handleMouseLeave }>
266270
<TableHeader
267271
ref='header'
272+
headerContainerClass={ this.props.headerContainerClass }
268273
tableHeaderClass={ this.props.tableHeaderClass }
269274
style={ this.props.headerStyle }
270275
rowSelectType={ this.props.selectRow.mode }
@@ -282,6 +287,7 @@ class BootstrapTable extends Component {
282287
{ this.props.children }
283288
</TableHeader>
284289
<TableBody ref='body'
290+
bodyContainerClass={ this.props.bodyContainerClass }
285291
tableBodyClass={ this.props.tableBodyClass }
286292
style={ { ...style, ...this.props.bodyStyle } }
287293
data={ this.state.data }
@@ -982,6 +988,10 @@ BootstrapTable.propTypes = {
982988
containerStyle: PropTypes.object,
983989
headerStyle: PropTypes.object,
984990
bodyStyle: PropTypes.object,
991+
containerClass: PropTypes.string,
992+
tableContainerClass: PropTypes.string,
993+
headerContainerClass: PropTypes.string,
994+
bodyContainerClass: PropTypes.string,
985995
tableHeaderClass: PropTypes.string,
986996
tableBodyClass: PropTypes.string,
987997
options: PropTypes.shape({
@@ -1072,6 +1082,10 @@ BootstrapTable.defaultProps = {
10721082
containerStyle: undefined,
10731083
headerStyle: undefined,
10741084
bodyStyle: undefined,
1085+
containerClass: null,
1086+
tableContainerClass: null,
1087+
headerContainerClass: null,
1088+
bodyContainerClass: null,
10751089
tableHeaderClass: null,
10761090
tableBodyClass: null,
10771091
options: {

src/TableBody.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ class TableBody extends Component {
139139
this.editing = false;
140140

141141
return (
142-
<div ref='container' className='react-bs-container-body' style={ this.props.style }>
142+
<div ref='container'
143+
className={ classSet('react-bs-container-body', this.props.bodyContainerClass) }
144+
style={ this.props.style }>
143145
<table className={ tableClasses }>
144146
{ tableHeader }
145147
<tbody ref='tbody'>
@@ -290,6 +292,7 @@ TableBody.propTypes = {
290292
onSelectRow: PropTypes.func,
291293
noDataText: PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]),
292294
style: PropTypes.object,
293-
tableBodyClass: PropTypes.string
295+
tableBodyClass: PropTypes.string,
296+
bodyContainerClass: PropTypes.string
294297
};
295298
export default TableBody;

src/TableHeader.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class Checkbox extends Component {
2323
class TableHeader extends Component {
2424

2525
render() {
26-
const containerClasses = classSet('react-bs-container-header', 'table-header-wrapper');
26+
const containerClasses = classSet(
27+
'react-bs-container-header',
28+
'table-header-wrapper',
29+
this.props.headerContainerClass);
2730
const tableClasses = classSet('table', 'table-hover', {
2831
'table-bordered': this.props.bordered,
2932
'table-condensed': this.props.condensed
@@ -78,6 +81,7 @@ class TableHeader extends Component {
7881
}
7982
}
8083
TableHeader.propTypes = {
84+
headerContainerClass: PropTypes.string,
8185
tableHeaderClass: PropTypes.string,
8286
style: PropTypes.object,
8387
rowSelectType: PropTypes.string,

0 commit comments

Comments
 (0)