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
031bf62e
Commit
031bf62e
authored
Jul 27, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check exist data in cells and delete it
ToDo Add confirm message
parent
3d265b15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
6 deletions
+35
-6
cell/model/Workbook.js
cell/model/Workbook.js
+35
-6
No files found.
cell/model/Workbook.js
View file @
031bf62e
...
...
@@ -4877,17 +4877,46 @@
};
Worksheet
.
prototype
.
updatePivotTable
=
function
(
pivotTable
)
{
pivotTable
.
init
();
var
pos
,
cells
,
index
;
var
cacheFields
=
pivotTable
.
asc_getCacheFields
();
var
pivotFields
=
pivotTable
.
asc_getPivotFields
();
var
pageFields
=
pivotTable
.
asc_getPageFields
();
pos
=
0
<
pivotTable
.
pageFieldsPositions
.
length
&&
pivotTable
.
pageFieldsPositions
[
0
];
var
pos
,
cells
,
bWarning
;
var
l
=
pivotTable
.
pageFieldsPositions
.
length
;
pos
=
0
<
l
&&
pivotTable
.
pageFieldsPositions
[
0
];
if
(
pos
&&
0
>
pos
.
row
)
{
// ToDo add check exist data in cells
pivotTable
.
getRange
().
setOffset
(
new
AscCommonExcel
.
CRangeOffset
(
0
,
-
1
*
pos
.
row
));
pivotTable
.
init
();
}
for
(
var
i
=
0
;
i
<
pivotTable
.
pageFieldsPositions
.
length
;
++
i
)
{
var
cleanRanges
=
[];
pivotTable
.
pageFieldsPositions
.
forEach
(
function
(
pageFieldPos
)
{
cells
=
this
.
getRange3
(
pageFieldPos
.
row
,
pageFieldPos
.
col
,
pageFieldPos
.
row
,
pageFieldPos
.
col
+
1
);
if
(
!
bWarning
)
{
cells
.
_foreachNoEmpty
(
function
(
cell
)
{
return
(
bWarning
=
!
cell
.
isEmptyText
())
?
null
:
cell
;
});
}
cleanRanges
.
push
(
cells
);
},
this
);
var
t
=
this
;
function
callback
(
res
)
{
if
(
res
)
{
t
.
_updatePivotTable
(
pivotTable
,
cleanRanges
);
}
}
if
(
bWarning
)
{
// ToDo add confirm event
callback
(
true
);
}
else
{
callback
(
true
);
}
};
Worksheet
.
prototype
.
_updatePivotTable
=
function
(
pivotTable
,
cleanRanges
)
{
cleanRanges
.
forEach
(
function
(
element
)
{
element
.
cleanAll
();
});
var
pos
,
cells
,
index
,
i
;
var
cacheFields
=
pivotTable
.
asc_getCacheFields
();
var
pivotFields
=
pivotTable
.
asc_getPivotFields
();
var
pageFields
=
pivotTable
.
asc_getPageFields
();
for
(
i
=
0
;
i
<
pivotTable
.
pageFieldsPositions
.
length
;
++
i
)
{
pos
=
pivotTable
.
pageFieldsPositions
[
i
];
cells
=
this
.
getRange3
(
pos
.
row
,
pos
.
col
,
pos
.
row
,
pos
.
col
);
index
=
pageFields
[
i
].
asc_getIndex
();
...
...
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