Skip to content

Commit 5cc2bb2

Browse files
committed
Enable Hide row on the expand with hideRowOnExpand as an options prop
1 parent 9b3ef8c commit 5cc2bb2

File tree

7 files changed

+37
-17
lines changed

7 files changed

+37
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ node_modules
88
lib/
99
npm-debug.log
1010
.vscode
11+
package-lock.json

dist/react-bootstrap-table.js

Lines changed: 17 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-bootstrap-table.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-bootstrap-table.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BootstrapTable.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class BootstrapTable extends Component {
438438
const { toolbarPosition = Const.TOOLBAR_POS_TOP } = this.props.options;
439439
const showToolbarOnTop = toolbarPosition !== Const.TOOLBAR_POS_BOTTOM;
440440
const showToolbarOnBottom = toolbarPosition !== Const.TOOLBAR_POS_TOP;
441-
441+
const { hideRowOnExpand = false } = this.props.options;
442442
return (
443443
<div className={ classSet('react-bs-table-container', this.props.className, this.props.containerClass) }
444444
style={ this.props.containerStyle }>
@@ -513,6 +513,7 @@ class BootstrapTable extends Component {
513513
x={ this.state.x }
514514
y={ this.state.y }
515515
withoutTabIndex={ this.props.withoutTabIndex }
516+
hideRowOnExpand={hideRowOnExpand}
516517
onEditCell={ this.handleEditCell } />
517518
{
518519
tableFooter
@@ -1694,7 +1695,8 @@ BootstrapTable.propTypes = {
16941695
beforeShowError: PropTypes.func,
16951696
printToolBar: PropTypes.bool,
16961697
insertFailIndicator: PropTypes.string,
1697-
noAutoBOM: PropTypes.bool
1698+
noAutoBOM: PropTypes.bool,
1699+
hideRowOnExpand: PropTypes.bool,
16981700
}),
16991701
fetchInfo: PropTypes.shape({
17001702
dataTotalSize: PropTypes.number
@@ -1861,7 +1863,8 @@ BootstrapTable.defaultProps = {
18611863
beforeShowError: undefined,
18621864
printToolBar: true,
18631865
insertFailIndicator: Const.INSERT_FAIL_INDICATOR,
1864-
noAutoBOM: true
1866+
noAutoBOM: true,
1867+
hideRowOnExpand: false,
18651868
},
18661869
fetchInfo: {
18671870
dataTotalSize: 0

src/TableBody.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class TableBody extends Component {
165165
);
166166
const haveExpandContent = this.props.expandableRow && this.props.expandableRow(data);
167167
const isExpanding = haveExpandContent && this.props.expanding.indexOf(key) > -1;
168-
168+
const { hideRowOnExpand } = this.props;
169169
// add by bluespring for className customize
170170
let trClassName = this.props.trClassName;
171171
if (Utils.isFunction(this.props.trClassName)) {
@@ -189,6 +189,7 @@ class TableBody extends Component {
189189
onExpandRow={ this.handleClickCell }
190190
unselectableRow={ disable }
191191
style={ trStyle }
192+
hidden={isExpanding && hideRowOnExpand}
192193
dbClickToEdit={ cellEdit.mode === Const.CELL_EDIT_DBCLICK } >
193194
{ this.props.expandColumnOptions.expandColumnVisible &&
194195
this.props.expandColumnOptions.expandColumnBeforeSelectColumn &&
@@ -547,6 +548,7 @@ TableBody.propTypes = {
547548
x: PropTypes.number,
548549
y: PropTypes.number,
549550
onNavigateCell: PropTypes.func,
550-
withoutTabIndex: PropTypes.bool
551+
withoutTabIndex: PropTypes.bool,
552+
hideRowOnExpand: PropTypes.bool,
551553
};
552554
export default TableBody;

src/TableRow.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class TableRow extends Component {
110110
onMouseOver={ this.rowMouseOver }
111111
onMouseOut={ this.rowMouseOut }
112112
onClick={ this.rowClick }
113+
hidden={this.props.hidden}
113114
onDoubleClick={ this.rowDoubleClick }>{ this.props.children }</tr>
114115
);
115116
}
@@ -126,10 +127,12 @@ TableRow.propTypes = {
126127
onExpandRow: PropTypes.func,
127128
onRowMouseOut: PropTypes.func,
128129
onRowMouseOver: PropTypes.func,
129-
unselectableRow: PropTypes.bool
130+
unselectableRow: PropTypes.bool,
131+
hidden: PropTypes.bool,
130132
};
131133
TableRow.defaultProps = {
132134
onRowClick: undefined,
133-
onRowDoubleClick: undefined
135+
onRowDoubleClick: undefined,
136+
hidden: false,
134137
};
135138
export default TableRow;

0 commit comments

Comments
 (0)