Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ var table = React.render(
<th></th>
<td>get row's className</td>
</tr>
<tr>
<td>rowRef</td>
<td>Function(record,index):string</td>
<th></th>
<td>get row's ref key</td>
</tr>
<tr>
<td>defaultExpandedRowKeys</td>
<td>String[]</td>
Expand Down
9 changes: 8 additions & 1 deletion src/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const Table = React.createClass({
showHeader: React.PropTypes.bool,
footer: React.PropTypes.func,
scroll: React.PropTypes.object,
rowRef: React.PropTypes.func,
},

getDefaultProps() {
Expand Down Expand Up @@ -57,6 +58,9 @@ const Table = React.createClass({
expandIconColumnIndex: 0,
showHeader: true,
scroll: {},
rowRef() {
return null;
},
};
},

Expand Down Expand Up @@ -185,6 +189,7 @@ const Table = React.createClass({
let rst = [];
const keyFn = props.rowKey;
const rowClassName = props.rowClassName;
const rowRef = props.rowRef;
const expandedRowClassName = props.expandedRowClassName;
const needIndentSpaced = props.data.some(record =>
record[childrenColumnName] && record[childrenColumnName].length > 0);
Expand Down Expand Up @@ -231,7 +236,9 @@ const Table = React.createClass({
expandIconColumnIndex={expandIconColumnIndex}
onRowClick={onRowClick}
{ ...onHoverProps }
key={key} />
key={key}
ref={rowRef(record, i)}
/>
);

const subVisible = visible && isRowExpanded;
Expand Down