diff --git a/src/Table.jsx b/src/Table.jsx index a60f4945c..26a188fd5 100644 --- a/src/Table.jsx +++ b/src/Table.jsx @@ -124,8 +124,9 @@ const Table = React.createClass({ const record = data[i]; const key = keyFn ? keyFn(record, i) : undefined; const childrenColumn = record[childrenColumnName]; + const isRowExpanded = this.isRowExpanded(record); let expandedRowContent; - if (expandedRowRender) { + if (expandedRowRender && isRowExpanded) { expandedRowContent = expandedRowRender(record, i); } const className = rowClassName(record, i); @@ -138,13 +139,13 @@ const Table = React.createClass({ visible={visible} onExpand={this.onExpanded} expandable={childrenColumn || expandedRowContent} - expanded={this.isRowExpanded(record)} + expanded={isRowExpanded} prefixCls={`${props.prefixCls}-row`} childrenColumnName={childrenColumnName} columns={columns} key={key}/>); - const subVisible = visible && this.isRowExpanded(record); + const subVisible = visible && isRowExpanded; if (expandedRowContent) { rst.push(this.getExpandedRow(key, expandedRowContent, subVisible, expandedRowClassName(record, i))); @@ -171,6 +172,13 @@ const Table = React.createClass({ return