mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
apply sorter for children
This commit is contained in:
parent
ff05904b54
commit
fb66e9c7e3
@ -719,12 +719,16 @@ export default class Table extends React.Component {
|
||||
|
||||
getLocalData() {
|
||||
const state = this.state;
|
||||
let data = this.props.dataSource || [];
|
||||
const { dataSource, childrenColumnName } = this.props;
|
||||
let data = dataSource || [];
|
||||
// 优化本地排序
|
||||
data = data.slice(0);
|
||||
const sorterFn = this.getSorterFn();
|
||||
if (sorterFn) {
|
||||
data = data.sort(sorterFn);
|
||||
data = data.sort(sorterFn).map(dataItem => (dataItem[childrenColumnName] ? {
|
||||
...dataItem,
|
||||
[childrenColumnName]: dataItem[childrenColumnName].sort(sorterFn),
|
||||
} : dataItem));
|
||||
}
|
||||
// 筛选
|
||||
if (state.filters) {
|
||||
|
Loading…
Reference in New Issue
Block a user