Skip to content

Commit 07038fc

Browse files
committed
Merge branch 'powellandy-expand-hide-row'
2 parents df7f410 + b48ca74 commit 07038fc

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/BootstrapTable.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class BootstrapTable extends Component {
454454
const { toolbarPosition = Const.TOOLBAR_POS_TOP } = this.props.options;
455455
const showToolbarOnTop = toolbarPosition !== Const.TOOLBAR_POS_BOTTOM;
456456
const showToolbarOnBottom = toolbarPosition !== Const.TOOLBAR_POS_TOP;
457-
457+
const { hideRowOnExpand = false } = this.props.options;
458458
return (
459459
<div className={ classSet('react-bs-table-container', this.props.className, this.props.containerClass) }
460460
style={ this.props.containerStyle }>
@@ -534,6 +534,7 @@ class BootstrapTable extends Component {
534534
x={ this.state.x }
535535
y={ this.state.y }
536536
withoutTabIndex={ this.props.withoutTabIndex }
537+
hideRowOnExpand={ hideRowOnExpand }
537538
onEditCell={ this.handleEditCell } />
538539
{
539540
tableFooter
@@ -1737,7 +1738,8 @@ BootstrapTable.propTypes = {
17371738
printToolBar: PropTypes.bool,
17381739
insertFailIndicator: PropTypes.string,
17391740
noAutoBOM: PropTypes.bool,
1740-
expandAll: PropTypes.bool
1741+
expandAll: PropTypes.bool,
1742+
hideRowOnExpand: PropTypes.bool
17411743
}),
17421744
fetchInfo: PropTypes.shape({
17431745
dataTotalSize: PropTypes.number
@@ -1908,7 +1910,8 @@ BootstrapTable.defaultProps = {
19081910
printToolBar: true,
19091911
insertFailIndicator: Const.INSERT_FAIL_INDICATOR,
19101912
noAutoBOM: true,
1911-
expandAll: false
1913+
expandAll: false,
1914+
hideRowOnExpand: false
19121915
},
19131916
fetchInfo: {
19141917
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 &&
@@ -557,6 +558,7 @@ TableBody.propTypes = {
557558
x: PropTypes.number,
558559
y: PropTypes.number,
559560
onNavigateCell: PropTypes.func,
560-
withoutTabIndex: PropTypes.bool
561+
withoutTabIndex: PropTypes.bool,
562+
hideRowOnExpand: PropTypes.bool
561563
};
562564
export default TableBody;

src/TableRow.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class TableRow extends Component {
7878

7979
render() {
8080
this.clickNum = 0;
81-
const { selectRow, row, isSelected, className, index } = this.props;
81+
const { selectRow, row, isSelected, className, index, hidden } = this.props;
8282
let { style } = this.props;
8383
let backgroundColor = null;
8484
let selectRowClass = null;
@@ -110,6 +110,7 @@ class TableRow extends Component {
110110
onMouseOver={ this.rowMouseOver }
111111
onMouseOut={ this.rowMouseOut }
112112
onClick={ this.rowClick }
113+
hidden={ 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)