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
bb98ed69
Commit
bb98ed69
authored
Aug 03, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix getValue with CT_Index
fix update values with empty column fields
parent
698507be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
+23
-18
cell/model/PivotTables.js
cell/model/PivotTables.js
+6
-3
cell/model/Workbook.js
cell/model/Workbook.js
+17
-15
No files found.
cell/model/PivotTables.js
View file @
bb98ed69
...
...
@@ -2708,18 +2708,22 @@ CT_pivotTableDefinition.prototype.getValues = function (records, index, value) {
var
elem
;
for
(
var
i
=
0
;
i
<
records
.
length
;
++
i
)
{
elem
=
records
[
i
][
index
];
if
(
elem
&&
0
===
elem
.
type
&&
value
===
elem
.
v
)
{
if
(
elem
&&
elem
instanceof
CT_Index
&&
value
===
elem
.
v
)
{
res
.
push
(
records
[
i
]);
}
}
return
res
;
};
CT_pivotTableDefinition
.
prototype
.
getValue
=
function
(
records
,
index
)
{
var
cacheFields
=
this
.
asc_getCacheFields
();
var
res
=
0
;
var
elem
;
for
(
var
i
=
0
;
i
<
records
.
length
;
++
i
)
{
elem
=
records
[
i
][
index
];
if
(
elem
)
{
if
(
elem
instanceof
CT_Index
)
{
elem
=
cacheFields
[
index
].
getSharedItem
(
elem
.
v
);
}
if
(
elem
instanceof
CT_Number
)
{
res
+=
elem
.
v
;
}
}
...
...
@@ -4090,7 +4094,6 @@ function CT_Index() {
//Attributes
this
.
v
=
null
;
}
CT_Index
.
prototype
.
type
=
0
;
CT_Index
.
prototype
.
readAttributes
=
function
(
attr
,
uq
)
{
if
(
attr
())
{
var
vals
=
attr
();
...
...
cell/model/Workbook.js
View file @
bb98ed69
...
...
@@ -4955,21 +4955,22 @@
var
cacheValuesCol
=
[];
var
cacheValuesRow
=
[];
// column
c1
=
pivotRange
.
c1
+
countR
;
r1
=
pivotRange
.
r1
;
if
(
countC
)
{
c1
=
pivotRange
.
c1
+
countR
;
r1
=
pivotRange
.
r1
;
cells
=
this
.
getRange4
(
r1
,
c1
);
cells
.
setValue
(
'
Column Labels
'
);
}
++
r1
;
++
r1
;
items
=
pivotTable
.
getColItems
();
if
(
items
&&
countC
)
{
for
(
i
=
0
;
i
<
items
.
length
;
++
i
)
{
item
=
items
[
i
];
r
=
item
.
getR
();
cacheRecord
=
cacheRecords
;
items
=
pivotTable
.
getColItems
();
if
(
items
)
{
for
(
i
=
0
;
i
<
items
.
length
;
++
i
)
{
item
=
items
[
i
];
r
=
item
.
getR
();
cacheRecord
=
cacheRecords
;
if
(
countC
)
{
for
(
j
=
0
;
j
<
item
.
x
.
length
;
++
j
)
{
if
(
AscCommonExcel
.
c_oAscItemType
.
Grand
===
item
.
t
)
{
field
=
null
;
...
...
@@ -4980,13 +4981,13 @@
indexField
=
colFields
[
r
+
j
].
asc_getIndex
();
field
=
pivotFields
[
indexField
];
cacheIndex
=
field
.
getItem
(
item
.
x
[
j
].
getV
());
sharedItem
=
cacheFields
[
indexField
].
getSharedItem
(
cacheIndex
.
x
);
// ToDo add other names by type
if
(
null
!==
item
.
t
)
{
oCellValue
=
new
AscCommonExcel
.
CCellValue
();
oCellValue
.
text
=
valuesWithFormat
[
r1
+
r
+
j
]
+
'
Total
'
;
oCellValue
.
type
=
AscCommon
.
CellValueType
.
String
;
}
else
{
sharedItem
=
cacheFields
[
indexField
].
getSharedItem
(
cacheIndex
.
x
);
oCellValue
=
sharedItem
.
getCellValue
();
}
...
...
@@ -5004,13 +5005,14 @@
valuesWithFormat
[
r1
+
r
+
j
]
=
cells
.
getValueWithFormat
();
}
}
if
(
countD
)
{
cacheValuesCol
.
push
(
cacheRecord
);
}
}
if
(
countD
)
{
cacheValuesCol
.
push
(
cacheRecord
);
}
}
}
// rows
if
(
countR
)
{
c1
=
pivotRange
.
c1
;
r1
=
pivotRange
.
r1
+
countC
;
...
...
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