diff --git a/README.md b/README.md
index d8faa612b..4aba60d83 100644
--- a/README.md
+++ b/README.md
@@ -150,6 +150,12 @@ var table = React.render(
|
get row's className |
+
+ rowRef |
+ Function(record,index):string |
+ |
+ get row's ref key |
+
defaultExpandedRowKeys |
String[] |
diff --git a/src/Table.jsx b/src/Table.jsx
index 26e89fedc..d7c399b3b 100644
--- a/src/Table.jsx
+++ b/src/Table.jsx
@@ -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() {
@@ -57,6 +58,9 @@ const Table = React.createClass({
expandIconColumnIndex: 0,
showHeader: true,
scroll: {},
+ rowRef() {
+ return null;
+ },
};
},
@@ -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);
@@ -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;