mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
fix: record key bug (#3166)
This commit is contained in:
parent
51da9c637c
commit
a7ba9004e1
@ -562,7 +562,11 @@ export default class Table extends React.Component<TableProps, any> {
|
||||
if (typeof rowKey === 'function') {
|
||||
return rowKey(record, index);
|
||||
}
|
||||
return record[rowKey as string] || index;
|
||||
let recordKey = record[rowKey as string] !== undefined ? record[rowKey as string] : index;
|
||||
warning(recordKey !== undefined,
|
||||
'Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key.'
|
||||
);
|
||||
return recordKey;
|
||||
}
|
||||
|
||||
checkSelection(data, type, byDefaultChecked) {
|
||||
|
Loading…
Reference in New Issue
Block a user