apply sorter for children

This commit is contained in:
Liu Yang 2016-08-25 21:12:23 +08:00
parent ff05904b54
commit fb66e9c7e3

View File

@ -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) {