From 04bc51cf8dc5ff24fc5d71b3bbf755a9787ca57d Mon Sep 17 00:00:00 2001 From: wbfsa Date: Sun, 2 Aug 2020 03:18:28 +0800 Subject: [PATCH] fix(pivot table show error): when column area have field and row area is null,pivot table show error --- src/controllers/pivotTable.js | 24 +++++++++++++++++++++++- src/global/array.js | 9 +++++++-- src/locale/en.js | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/controllers/pivotTable.js b/src/controllers/pivotTable.js index 1a34ccfe0..80ab3c31f 100644 --- a/src/controllers/pivotTable.js +++ b/src/controllers/pivotTable.js @@ -2899,7 +2899,7 @@ const pivotTable = { } let datacoltitle_index = datacoltitle; - datacoltitle = luckysheetArray.transpose(datacoltitle); + datacoltitle = luckysheetArray.transpose(datacoltitle, false); let valuenslen = values.length == 0 ? 0 : 1; let rowLen = (datacoltitle.length == 0 ? valuenslen : datacoltitle.length) + (datarowtitle.length == 0 ? valuenslen : datarowtitle.length), colLen = (datacoltitle.length == 0 ? valuenslen : datacoltitle[0].length) + (datarowtitle.length == 0 ? valuenslen : datarowtitle[0].length); @@ -3015,6 +3015,28 @@ const pivotTable = { retdata[0][0] = values[0].fullname; retdata.splice(column.length, 1); } + else if(values.length == 1 && column.length > 0){ + // 0: (6) ["English", "foreign language", "mathematics", "science", "Sum", undefined] + // 1: (6) ["CountA:score", "CountA:score", "CountA:score", "CountA:score", "CountA:score", undefined] + // 2: (6) [3, 3, 3, 3, 12, ""] + //The above format does not meet viewing habits,Process retdata into the correct format + let titleRow = retdata.splice(column.length, 1); + let newRetdata = []; + for(let r=0;r