console.log agregar item row subtotal test
This commit is contained in:
parent
a3b3b8db64
commit
6f4e0dcada
@ -93,6 +93,25 @@ function makeRenderer() {
|
|||||||
console.log('rowAttrs', rowAttrs);
|
console.log('rowAttrs', rowAttrs);
|
||||||
var rowKeys = pivotData.getRowKeys();
|
var rowKeys = pivotData.getRowKeys();
|
||||||
var colKeys = pivotData.getColKeys();
|
var colKeys = pivotData.getColKeys();
|
||||||
|
var rowKeysSub = [];
|
||||||
|
if (rowAttrs !== null && rowAttrs.length > 1) {
|
||||||
|
var beforeFirstKey = null;
|
||||||
|
for (var idx = 0; idx < rowKeys.length; idx++) {
|
||||||
|
var arrRowKeys = rowKeys[idx];
|
||||||
|
var currentFirstKey = arrRowKeys[0];
|
||||||
|
if (beforeFirstKey === null) {
|
||||||
|
beforeFirstKey = currentFirstKey;
|
||||||
|
}
|
||||||
|
if (beforeFirstKey !== currentFirstKey) {
|
||||||
|
rowKeysSub.push([beforeFirstKey, '[:sub-total:]']);
|
||||||
|
beforeFirstKey = currentFirstKey;
|
||||||
|
}
|
||||||
|
rowKeysSub.push(arrRowKeys);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rowKeysSub = pivotData.getRowKeys();
|
||||||
|
}
|
||||||
|
console.log('rowKeysSub', rowKeysSub);
|
||||||
var grandTotalAggregator = pivotData.getAggregator([], []);
|
var grandTotalAggregator = pivotData.getAggregator([], []);
|
||||||
|
|
||||||
var getStylesHeaders = function getStylesHeaders() {
|
var getStylesHeaders = function getStylesHeaders() {
|
||||||
@ -364,13 +383,14 @@ function makeRenderer() {
|
|||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
null,
|
null,
|
||||||
rowKeys.map(function (rowKey, i) {
|
rowKeysSub.map(function (rowKey, i) {
|
||||||
var totalAggregator = pivotData.getAggregator(rowKey, []);
|
var totalAggregator = pivotData.getAggregator(rowKey, []);
|
||||||
|
var isSubTotal = rowKey.includes('[:sub-total:]');
|
||||||
return _react2.default.createElement(
|
return _react2.default.createElement(
|
||||||
'tr',
|
'tr',
|
||||||
{ key: 'rowKeyRow' + i },
|
{ key: 'rowKeyRow' + i },
|
||||||
rowKey.map(function (txt, j) {
|
rowKey.map(function (txt, j) {
|
||||||
var x = spanSize(rowKeys, i, j);
|
var x = spanSize(rowKeysSub, i, j);
|
||||||
if (x === -1) {
|
if (x === -1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -396,7 +416,7 @@ function makeRenderer() {
|
|||||||
onClick: getClickHandler && getClickHandler(aggregator.value(), rowKey, colKey),
|
onClick: getClickHandler && getClickHandler(aggregator.value(), rowKey, colKey),
|
||||||
style: valueCellColors(rowKey, colKey, aggregator.value())
|
style: valueCellColors(rowKey, colKey, aggregator.value())
|
||||||
},
|
},
|
||||||
getFormatedValue(aggregator)
|
isSubTotal ? 'a' : getFormatedValue(aggregator)
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
_react2.default.createElement(
|
_react2.default.createElement(
|
||||||
@ -406,7 +426,7 @@ function makeRenderer() {
|
|||||||
onClick: getClickHandler && getClickHandler(totalAggregator.value(), rowKey, [null]),
|
onClick: getClickHandler && getClickHandler(totalAggregator.value(), rowKey, [null]),
|
||||||
style: colTotalColors(totalAggregator.value())
|
style: colTotalColors(totalAggregator.value())
|
||||||
},
|
},
|
||||||
getFormatedValue(totalAggregator)
|
isSubTotal ? 'a' : getFormatedValue(totalAggregator)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "v-react-pivottable",
|
"name": "v-react-pivottable",
|
||||||
"version": "0.11.48",
|
"version": "0.11.49",
|
||||||
"description": "A React-based pivot table",
|
"description": "A React-based pivot table",
|
||||||
"main": "PivotTableUI.js",
|
"main": "PivotTableUI.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
Loading…
Reference in New Issue
Block a user