Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
a0035c7f
Commit
a0035c7f
authored
Aug 04, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support other types of subtotals it fields
parent
50bab978
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
46 deletions
+58
-46
cell/model/FormulaObjects/mathematicFunctions.js
cell/model/FormulaObjects/mathematicFunctions.js
+4
-0
cell/model/PivotTables.js
cell/model/PivotTables.js
+51
-45
cell/model/Workbook.js
cell/model/Workbook.js
+3
-1
No files found.
cell/model/FormulaObjects/mathematicFunctions.js
View file @
a0035c7f
...
...
@@ -4945,4 +4945,8 @@
return
this
.
value
=
truncHelper
(
arg0
.
getValue
(),
arg1
.
getValue
());
};
//----------------------------------------------------------export----------------------------------------------------
window
[
'
AscCommonExcel
'
]
=
window
[
'
AscCommonExcel
'
]
||
{};
window
[
'
AscCommonExcel
'
].
cSUBTOTAL
=
cSUBTOTAL
;
})(
window
);
cell/model/PivotTables.js
View file @
a0035c7f
...
...
@@ -21,34 +21,34 @@ var c_oAscFieldSortType = {
Descending
:
2
};
var
c_oAscItemType
=
{
D
ata
:
0
,
Default
:
1
,
Sum
:
2
,
D
efault
:
0
,
Avg
:
1
,
Count
:
2
,
CountA
:
3
,
Avg
:
4
,
M
ax
:
5
,
Min
:
6
,
Product
:
7
,
Count
:
8
,
S
tdDev
:
9
,
StdDevP
:
10
,
Var
:
11
,
VarP
:
12
,
Max
:
4
,
M
in
:
5
,
Product
:
6
,
StdDev
:
7
,
StdDevP
:
8
,
S
um
:
9
,
Var
:
10
,
Var
P
:
11
,
Data
:
12
,
Grand
:
13
,
Blank
:
14
};
var
c_oAscDataConsolidateFunction
=
{
Average
:
0
,
Count
:
1
,
CountNums
:
2
,
Max
:
3
,
Min
:
4
,
Product
:
5
,
StdDev
:
6
,
StdDevp
:
7
,
Sum
:
8
,
Var
:
9
,
Varp
:
1
0
Average
:
1
,
Count
:
2
,
CountNums
:
3
,
Max
:
4
,
Min
:
5
,
Product
:
6
,
StdDev
:
7
,
StdDevp
:
8
,
Sum
:
9
,
Var
:
10
,
Varp
:
1
1
};
var
c_oAscShowDataAs
=
{
Normal
:
0
,
...
...
@@ -426,36 +426,36 @@ function ToXml_ST_ItemType(val) {
function
ToName_ST_ItemType
(
val
)
{
var
res
=
'
'
;
if
(
c_oAscItemType
.
Data
===
val
)
{
res
+=
"
data
"
;
}
else
if
(
c_oAscItemType
.
Default
===
val
)
{
if
(
c_oAscItemType
.
Default
===
val
)
{
res
+=
'
Total
'
;
}
else
if
(
c_oAscItemType
.
Sum
===
val
)
{
res
=
'
Sum
'
;
}
else
if
(
c_oAscItemType
.
CountA
===
val
)
{
res
=
'
Count
'
;
}
else
if
(
c_oAscItemType
.
Avg
===
val
)
{
res
=
'
Average
'
;
res
+=
'
Average
'
;
}
else
if
(
c_oAscItemType
.
Count
===
val
)
{
res
+=
'
Count
'
;
}
else
if
(
c_oAscItemType
.
CountA
===
val
)
{
res
+=
'
Count
'
;
}
else
if
(
c_oAscItemType
.
Max
===
val
)
{
res
=
'
Max
'
;
res
+
=
'
Max
'
;
}
else
if
(
c_oAscItemType
.
Min
===
val
)
{
res
=
'
Min
'
;
res
+
=
'
Min
'
;
}
else
if
(
c_oAscItemType
.
Product
===
val
)
{
res
=
'
Product
'
;
}
else
if
(
c_oAscItemType
.
Count
===
val
)
{
res
=
'
Count
'
;
res
+=
'
Product
'
;
}
else
if
(
c_oAscItemType
.
StdDev
===
val
)
{
res
=
'
StdDev
'
;
res
+
=
'
StdDev
'
;
}
else
if
(
c_oAscItemType
.
StdDevP
===
val
)
{
res
=
'
StdDevp
'
;
res
+=
'
StdDevp
'
;
}
else
if
(
c_oAscItemType
.
Sum
===
val
)
{
res
+=
'
Sum
'
;
}
else
if
(
c_oAscItemType
.
Var
===
val
)
{
res
=
'
Var
'
;
res
+
=
'
Var
'
;
}
else
if
(
c_oAscItemType
.
VarP
===
val
)
{
res
=
'
Varp
'
;
res
+=
'
Varp
'
;
}
else
if
(
c_oAscItemType
.
Data
===
val
)
{
res
+=
'
Data
'
;
}
else
if
(
c_oAscItemType
.
Grand
===
val
)
{
res
+=
'
Total
'
;
}
else
if
(
c_oAscItemType
.
Blank
===
val
)
{
res
=
"
blank
"
;
res
+=
'
Blank
'
;
}
return
res
;
}
...
...
@@ -2750,9 +2750,12 @@ CT_pivotTableDefinition.prototype.getValues = function (records, index, value) {
}
return
res
;
};
CT_pivotTableDefinition
.
prototype
.
getValue
=
function
(
records
,
index
)
{
CT_pivotTableDefinition
.
prototype
.
getValue
=
function
(
records
,
index
,
subtotal
)
{
var
cacheFields
=
this
.
asc_getCacheFields
();
var
res
=
0
;
if
(
c_oAscItemType
.
Default
===
subtotal
||
c_oAscItemType
.
Data
===
subtotal
||
c_oAscItemType
.
Blank
===
subtotal
)
{
subtotal
=
c_oAscItemType
.
Sum
;
}
var
arg
=
[
new
AscCommonExcel
.
cNumber
(
subtotal
)];
var
elem
;
for
(
var
i
=
0
;
i
<
records
.
length
;
++
i
)
{
elem
=
records
[
i
][
index
];
...
...
@@ -2760,10 +2763,13 @@ CT_pivotTableDefinition.prototype.getValue = function (records, index) {
elem
=
cacheFields
[
index
].
getSharedItem
(
elem
.
v
);
}
if
(
elem
instanceof
CT_Number
)
{
res
+=
elem
.
v
;
arg
.
push
(
new
AscCommonExcel
.
cNumber
(
elem
.
v
))
;
}
}
return
res
;
var
f
=
new
AscCommonExcel
.
cSUBTOTAL
();
return
f
.
Calculate
(
arg
);
};
CT_pivotTableDefinition
.
prototype
.
asc_getName
=
function
()
{
return
this
.
name
;
...
...
cell/model/Workbook.js
View file @
a0035c7f
...
...
@@ -5096,7 +5096,9 @@
if
(
0
!==
cacheRecord
.
length
)
{
cells
=
this
.
getRange4
(
r1
+
i
,
rowFieldsPos
[
r
]
+
1
+
j
);
oCellValue
=
new
AscCommonExcel
.
CCellValue
();
oCellValue
.
number
=
pivotTable
.
getValue
(
cacheRecord
,
dataFields
[
0
].
asc_getIndex
());
oCellValue
.
number
=
pivotTable
.
getValue
(
cacheRecord
,
dataFields
[
0
].
asc_getIndex
(),
(
null
!==
item
.
t
&&
c_oAscItemType
.
Grand
!==
item
.
t
)
?
item
.
t
:
dataFields
[
0
].
asc_getSubtotal
());
oCellValue
.
type
=
AscCommon
.
CellValueType
.
Number
;
cells
.
setValueData
(
new
AscCommonExcel
.
UndoRedoData_CellValueData
(
null
,
oCellValue
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment