feat: 排序回调新增data参数
This commit is contained in:
parent
ba317900d3
commit
344e948141
|
@ -292,7 +292,7 @@ function sort(Table, Icon) {
|
||||||
} else {
|
} else {
|
||||||
data = oldData.concat();
|
data = oldData.concat();
|
||||||
}
|
}
|
||||||
typeof sort.sortFun === "function" && sort.sortFun(sortCol, data);
|
typeof sort.sortFun === "function" && sort.sortFun(sortCol, data, oldData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seleObj = flatColumns.find(function (da) {
|
seleObj = flatColumns.find(function (da) {
|
||||||
|
@ -310,7 +310,7 @@ function sort(Table, Icon) {
|
||||||
sort.sortFun(sortCol);
|
sort.sortFun(sortCol);
|
||||||
} else {
|
} else {
|
||||||
data = _this3.multiSort(flatColumns);
|
data = _this3.multiSort(flatColumns);
|
||||||
typeof sort.sortFun === "function" && sort.sortFun(sortCol, data);
|
typeof sort.sortFun === "function" && sort.sortFun(sortCol, data, oldData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_this3.setState({ data: data, oldData: oldData, flatColumns: flatColumns });
|
_this3.setState({ data: data, oldData: oldData, flatColumns: flatColumns });
|
||||||
|
|
|
@ -25,6 +25,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
||||||
|
|
||||||
function sum(Table) {
|
function sum(Table) {
|
||||||
|
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
||||||
|
|
||||||
return function (_React$Component) {
|
return function (_React$Component) {
|
||||||
_inherits(SumTable, _React$Component);
|
_inherits(SumTable, _React$Component);
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ function sum(Table) {
|
||||||
count += _num;
|
count += _num;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sumdata[column.dataIndex] = (0, _utils.DicimalFormater)(count, 2);
|
sumdata[column.dataIndex] = (0, _utils.DicimalFormater)(count, precision);
|
||||||
}
|
}
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
sumdata[column.dataIndex] = "合计 " + sumdata[column.dataIndex];
|
sumdata[column.dataIndex] = "合计 " + sumdata[column.dataIndex];
|
||||||
|
|
|
@ -195,7 +195,7 @@ export default function sort(Table, Icon) {
|
||||||
} else {
|
} else {
|
||||||
data = oldData.concat();
|
data = oldData.concat();
|
||||||
}
|
}
|
||||||
typeof sort.sortFun === "function" && sort.sortFun(sortCol,data);
|
typeof sort.sortFun === "function" && sort.sortFun(sortCol,data,oldData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seleObj = flatColumns.find(da => da.key == column.key);
|
seleObj = flatColumns.find(da => da.key == column.key);
|
||||||
|
@ -211,7 +211,7 @@ export default function sort(Table, Icon) {
|
||||||
sort.sortFun(sortCol);
|
sort.sortFun(sortCol);
|
||||||
} else {
|
} else {
|
||||||
data = this.multiSort(flatColumns);
|
data = this.multiSort(flatColumns);
|
||||||
typeof sort.sortFun === "function" && sort.sortFun(sortCol,data);
|
typeof sort.sortFun === "function" && sort.sortFun(sortCol,data,oldData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setState({ data, oldData, flatColumns });
|
this.setState({ data, oldData, flatColumns });
|
||||||
|
|
Loading…
Reference in New Issue