Skip to content

Commit

Permalink
fix #647
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Aug 27, 2016
1 parent c6d2053 commit b426974
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint no-alert: 0 */
/* eslint max-len: 0 */
import React, { Component, PropTypes } from 'react';
import classSet from 'classnames';
import Const from './Const';
import TableHeader from './TableHeader';
import TableBody from './TableBody';
Expand Down Expand Up @@ -258,13 +259,17 @@ class BootstrapTable extends Component {
let sortIndicator = this.props.options.sortIndicator;
if (typeof this.props.options.sortIndicator === 'undefined') sortIndicator = true;
return (
<div className='react-bs-table-container' style={ this.props.containerStyle }>
<div className={ classSet('react-bs-table-container', this.props.containerClass) }
style={ this.props.containerStyle }>
{ toolBar }
<div className='react-bs-table' ref='table' style={ { ...style, ...this.props.tableStyle } }
<div ref='table'
className={ classSet('react-bs-table', this.props.tableContainerClass) }
style={ { ...style, ...this.props.tableStyle } }
onMouseEnter={ this.handleMouseEnter }
onMouseLeave={ this.handleMouseLeave }>
<TableHeader
ref='header'
headerContainerClass={ this.props.headerContainerClass }
tableHeaderClass={ this.props.tableHeaderClass }
style={ this.props.headerStyle }
rowSelectType={ this.props.selectRow.mode }
Expand All @@ -282,6 +287,7 @@ class BootstrapTable extends Component {
{ this.props.children }
</TableHeader>
<TableBody ref='body'
bodyContainerClass={ this.props.bodyContainerClass }
tableBodyClass={ this.props.tableBodyClass }
style={ { ...style, ...this.props.bodyStyle } }
data={ this.state.data }
Expand Down Expand Up @@ -982,6 +988,10 @@ BootstrapTable.propTypes = {
containerStyle: PropTypes.object,
headerStyle: PropTypes.object,
bodyStyle: PropTypes.object,
containerClass: PropTypes.string,
tableContainerClass: PropTypes.string,
headerContainerClass: PropTypes.string,
bodyContainerClass: PropTypes.string,
tableHeaderClass: PropTypes.string,
tableBodyClass: PropTypes.string,
options: PropTypes.shape({
Expand Down Expand Up @@ -1072,6 +1082,10 @@ BootstrapTable.defaultProps = {
containerStyle: undefined,
headerStyle: undefined,
bodyStyle: undefined,
containerClass: null,
tableContainerClass: null,
headerContainerClass: null,
bodyContainerClass: null,
tableHeaderClass: null,
tableBodyClass: null,
options: {
Expand Down
7 changes: 5 additions & 2 deletions src/TableBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ class TableBody extends Component {
this.editing = false;

return (
<div ref='container' className='react-bs-container-body' style={ this.props.style }>
<div ref='container'
className={ classSet('react-bs-container-body', this.props.bodyContainerClass) }
style={ this.props.style }>
<table className={ tableClasses }>
{ tableHeader }
<tbody ref='tbody'>
Expand Down Expand Up @@ -290,6 +292,7 @@ TableBody.propTypes = {
onSelectRow: PropTypes.func,
noDataText: PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]),
style: PropTypes.object,
tableBodyClass: PropTypes.string
tableBodyClass: PropTypes.string,
bodyContainerClass: PropTypes.string
};
export default TableBody;
6 changes: 5 additions & 1 deletion src/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class Checkbox extends Component {
class TableHeader extends Component {

render() {
const containerClasses = classSet('react-bs-container-header', 'table-header-wrapper');
const containerClasses = classSet(
'react-bs-container-header',
'table-header-wrapper',
this.props.headerContainerClass);
const tableClasses = classSet('table', 'table-hover', {
'table-bordered': this.props.bordered,
'table-condensed': this.props.condensed
Expand Down Expand Up @@ -78,6 +81,7 @@ class TableHeader extends Component {
}
}
TableHeader.propTypes = {
headerContainerClass: PropTypes.string,
tableHeaderClass: PropTypes.string,
style: PropTypes.object,
rowSelectType: PropTypes.string,
Expand Down

0 comments on commit b426974

Please sign in to comment.