Skip to content

Commit 4a43a08

Browse files
author
Bradley Smagacz
committed
added defaultValue props
1 parent 6a5087f commit 4a43a08

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/BootstrapTable.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ class BootstrapTable extends Component {
425425
tableBodyClass={ this.props.tableBodyClass }
426426
style={ { ...style, ...this.props.bodyStyle } }
427427
data={ this.state.data }
428+
defaultValue={ this.props.defaultValue }
428429
expandComponent={ this.props.expandComponent }
429430
expandableRow={ this.props.expandableRow }
430431
expandRowBgColor={ this.props.options.expandRowBgColor }
@@ -1426,6 +1427,7 @@ BootstrapTable.propTypes = {
14261427
height: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
14271428
maxHeight: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
14281429
data: PropTypes.oneOfType([ PropTypes.array, PropTypes.object ]),
1430+
defaultValue: PropTypes.string,
14291431
remote: PropTypes.oneOfType([ PropTypes.bool, PropTypes.func ]), // remote data, default is false
14301432
replace: PropTypes.oneOfType([ PropTypes.bool, PropTypes.func ]),
14311433
scrollTop: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),

src/TableBody.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class TableBody extends Component {
109109
} else {
110110
columnTitle = column.columnTitle && fieldValue ? fieldValue.toString() : null;
111111
}
112+
if (!columnChild) { columnChild = this.props.defaultValue; }
112113
return (
113114
<TableColumn key={ i }
114115
rIndex={ r }
@@ -500,6 +501,7 @@ class TableBody extends Component {
500501
}
501502
TableBody.propTypes = {
502503
data: PropTypes.array,
504+
defaultValue: PropTypes.string,
503505
columns: PropTypes.array,
504506
striped: PropTypes.bool,
505507
bordered: PropTypes.bool,

0 commit comments

Comments
 (0)