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
de5df82f
Commit
de5df82f
authored
Oct 23, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recalculate formulas after set hidden row into tables
parent
8361d4e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
14 deletions
+74
-14
cell/model/Workbook.js
cell/model/Workbook.js
+3
-0
cell/model/autofilters.js
cell/model/autofilters.js
+71
-14
No files found.
cell/model/Workbook.js
View file @
de5df82f
...
@@ -3970,6 +3970,8 @@
...
@@ -3970,6 +3970,8 @@
{
{
this
.
getRange3
(
start
,
0
,
stop
,
0
).
_foreachRow
(
fProcessRow
);
this
.
getRange3
(
start
,
0
,
stop
,
0
).
_foreachRow
(
fProcessRow
);
}
}
//todo возможно стоит вызывать эту функцию только в случае открытия строк
this
.
autoFilters
.
recalFormulasAfterTableRowHidden
(
start
,
stop
);
};
};
Worksheet
.
prototype
.
getRowHidden
=
function
(
index
){
Worksheet
.
prototype
.
getRowHidden
=
function
(
index
){
var
res
;
var
res
;
...
@@ -4024,6 +4026,7 @@
...
@@ -4024,6 +4026,7 @@
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_RowHide
,
oThis
.
getId
(),
updateRange
,
new
UndoRedoData_FromToRowCol
(
bHidden
,
startIndex
,
endIndex
));
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoWorksheet
,
AscCH
.
historyitem_Worksheet_RowHide
,
oThis
.
getId
(),
updateRange
,
new
UndoRedoData_FromToRowCol
(
bHidden
,
startIndex
,
endIndex
));
}
}
}
}
this
.
autoFilters
.
recalFormulasAfterTableRowHidden
(
start
,
stop
);
};
};
Worksheet
.
prototype
.
setRowBestFit
=
function
(
bBestFit
,
height
,
start
,
stop
){
Worksheet
.
prototype
.
setRowBestFit
=
function
(
bBestFit
,
height
,
start
,
stop
){
//start, stop 0 based
//start, stop 0 based
...
...
cell/model/autofilters.js
View file @
de5df82f
...
@@ -370,6 +370,9 @@
...
@@ -370,6 +370,9 @@
this
.
worksheet
=
currentSheet
;
this
.
worksheet
=
currentSheet
;
this
.
changeFilters
=
null
;
this
.
changeFilters
=
null
;
this
.
needRecalcFormulas
=
false
;
this
.
doNotRecalcFormulas
=
false
;
this
.
m_oColor
=
new
AscCommon
.
CColor
(
120
,
120
,
120
);
this
.
m_oColor
=
new
AscCommon
.
CColor
(
120
,
120
,
120
);
return
this
;
return
this
;
}
}
...
@@ -592,12 +595,14 @@
...
@@ -592,12 +595,14 @@
var
rangeOldFilter
=
null
;
var
rangeOldFilter
=
null
;
//**get filter**
//**get filter**
var
filterObj
=
this
.
_getPressedFilter
(
ar
,
autoFiltersObject
.
cellId
)
var
filterObj
=
this
.
_getPressedFilter
(
ar
,
autoFiltersObject
.
cellId
)
;
var
currentFilter
=
filterObj
.
filter
;
var
currentFilter
=
filterObj
.
filter
;
if
(
filterObj
.
filter
===
null
)
if
(
filterObj
.
filter
===
null
)
return
;
return
;
this
.
_waitRecalFormulasAfterTableRowHidden
(
true
);
//if apply a/f from context menu
//if apply a/f from context menu
if
(
autoFiltersObject
&&
null
===
autoFiltersObject
.
automaticRowCount
&&
currentFilter
.
isAutoFilter
()
&&
currentFilter
.
isApplyAutoFilter
()
===
false
)
if
(
autoFiltersObject
&&
null
===
autoFiltersObject
.
automaticRowCount
&&
currentFilter
.
isAutoFilter
()
&&
currentFilter
.
isApplyAutoFilter
()
===
false
)
{
{
...
@@ -759,6 +764,7 @@
...
@@ -759,6 +764,7 @@
{
{
this
.
_resetTablePartStyle
();
this
.
_resetTablePartStyle
();
}
}
this
.
_waitRecalFormulasAfterTableRowHidden
(
false
);
return
{
minChangeRow
:
minChangeRow
,
rangeOldFilter
:
rangeOldFilter
,
nOpenRowsCount
:
nOpenRowsCount
,
nAllRowsCount
:
nAllRowsCount
};
return
{
minChangeRow
:
minChangeRow
,
rangeOldFilter
:
rangeOldFilter
,
nOpenRowsCount
:
nOpenRowsCount
,
nAllRowsCount
:
nAllRowsCount
};
},
},
...
@@ -770,6 +776,8 @@
...
@@ -770,6 +776,8 @@
var
bRedoChanges
=
worksheet
.
workbook
.
bRedoChanges
;
var
bRedoChanges
=
worksheet
.
workbook
.
bRedoChanges
;
var
minChangeRow
;
var
minChangeRow
;
this
.
_waitRecalFormulasAfterTableRowHidden
(
true
);
//**get filter**
//**get filter**
var
filter
=
this
.
_getFilterByDisplayName
(
displayName
);
var
filter
=
this
.
_getFilterByDisplayName
(
displayName
);
var
autoFilter
=
filter
&&
false
===
filter
.
isAutoFilter
()
?
filter
.
AutoFilter
:
filter
;
var
autoFilter
=
filter
&&
false
===
filter
.
isAutoFilter
()
?
filter
.
AutoFilter
:
filter
;
...
@@ -811,6 +819,7 @@
...
@@ -811,6 +819,7 @@
History
.
EndTransaction
();
History
.
EndTransaction
();
this
.
_waitRecalFormulasAfterTableRowHidden
(
false
);
return
{
minChangeRow
:
minChangeRow
,
updateRange
:
filter
.
Ref
,
filter
:
filter
};
return
{
minChangeRow
:
minChangeRow
,
updateRange
:
filter
.
Ref
,
filter
:
filter
};
},
},
...
@@ -1285,6 +1294,8 @@
...
@@ -1285,6 +1294,8 @@
return
bRes
;
return
bRes
;
};
};
this
.
_waitRecalFormulasAfterTableRowHidden
(
true
);
if
(
worksheet
.
AutoFilter
&&
!
bNotDeleteAutoFilter
)
if
(
worksheet
.
AutoFilter
&&
!
bNotDeleteAutoFilter
)
{
{
changeFilter
(
worksheet
.
AutoFilter
);
changeFilter
(
worksheet
.
AutoFilter
);
...
@@ -1298,6 +1309,7 @@
...
@@ -1298,6 +1309,7 @@
}
}
}
}
this
.
_waitRecalFormulasAfterTableRowHidden
(
false
);
t
.
_setStyleTablePartsAfterOpenRows
(
activeCells
);
t
.
_setStyleTablePartsAfterOpenRows
(
activeCells
);
History
.
EndTransaction
();
History
.
EndTransaction
();
...
@@ -1358,6 +1370,40 @@
...
@@ -1358,6 +1370,40 @@
return
false
;
return
false
;
},
},
recalFormulasAfterTableRowHidden
:
function
(
start
,
stop
)
{
var
worksheet
=
this
.
worksheet
;
var
tableParts
=
worksheet
.
TableParts
;
var
tablePart
;
for
(
var
i
=
0
;
i
<
tableParts
.
length
;
i
++
)
{
tablePart
=
tableParts
[
i
];
if
(
tablePart
&&
tablePart
.
isTotalsRow
()
&&
start
>=
tablePart
.
Ref
.
r1
&&
stop
<=
tablePart
.
Ref
.
r2
)
{
if
(
this
.
doNotRecalcFormulas
){
this
.
needRecalcFormulas
=
true
;
}
else
{
this
.
_recalcFormulas
();
}
break
;
}
}
},
_waitRecalFormulasAfterTableRowHidden
:
function
(
bWait
){
if
(
bWait
){
this
.
doNotRecalcFormulas
=
true
;
}
else
{
if
(
this
.
needRecalcFormulas
){
this
.
_recalcFormulas
();
}
this
.
needRecalcFormulas
=
false
;
this
.
doNotRecalcFormulas
=
false
;
}
},
_recalcFormulas
:
function
(){
this
.
worksheet
.
workbook
.
dependencyFormulas
.
calcTree
();
},
_cleanStylesTables
:
function
(
redrawTablesArr
)
{
_cleanStylesTables
:
function
(
redrawTablesArr
)
{
for
(
var
i
=
0
;
i
<
redrawTablesArr
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
redrawTablesArr
.
length
;
i
++
)
{
this
.
_cleanStyleTable
(
redrawTablesArr
[
i
].
oldfilterRef
);
this
.
_cleanStyleTable
(
redrawTablesArr
[
i
].
oldfilterRef
);
...
@@ -2085,6 +2131,8 @@
...
@@ -2085,6 +2131,8 @@
var
bUndoChanges
=
worksheet
.
workbook
.
bUndoChanges
;
var
bUndoChanges
=
worksheet
.
workbook
.
bUndoChanges
;
var
bRedoChanges
=
worksheet
.
workbook
.
bRedoChanges
;
var
bRedoChanges
=
worksheet
.
workbook
.
bRedoChanges
;
this
.
_waitRecalFormulasAfterTableRowHidden
(
true
);
if
(
arnTo
==
null
&&
arnFrom
==
null
&&
data
)
if
(
arnTo
==
null
&&
arnFrom
==
null
&&
data
)
{
{
arnTo
=
data
.
moveFrom
?
data
.
moveFrom
:
null
;
arnTo
=
data
.
moveFrom
?
data
.
moveFrom
:
null
;
...
@@ -2185,6 +2233,7 @@
...
@@ -2185,6 +2233,7 @@
}
}
}
}
this
.
_waitRecalFormulasAfterTableRowHidden
(
false
);
return
isUpdate
?
range
:
null
;
return
isUpdate
?
range
:
null
;
},
},
...
@@ -4015,6 +4064,11 @@
...
@@ -4015,6 +4064,11 @@
values
[
count
]
=
tempResult
;
values
[
count
]
=
tempResult
;
};
};
if
(
isOpenHiddenRows
)
{
this
.
_waitRecalFormulasAfterTableRowHidden
(
true
);
}
var
maxFilterRow
=
ref
.
r2
;
var
maxFilterRow
=
ref
.
r2
;
var
automaticRowCount
=
null
;
var
automaticRowCount
=
null
;
...
@@ -4113,6 +4167,10 @@
...
@@ -4113,6 +4167,10 @@
individualCount
++
;
individualCount
++
;
}
}
if
(
isOpenHiddenRows
)
{
this
.
_waitRecalFormulasAfterTableRowHidden
(
false
);
}
return
{
values
:
this
.
_sortArrayMinMax
(
values
),
automaticRowCount
:
automaticRowCount
};
return
{
values
:
this
.
_sortArrayMinMax
(
values
),
automaticRowCount
:
automaticRowCount
};
},
},
...
@@ -4215,6 +4273,7 @@
...
@@ -4215,6 +4273,7 @@
if
(
colId
===
null
)
if
(
colId
===
null
)
return
;
return
;
this
.
_waitRecalFormulasAfterTableRowHidden
(
true
);
for
(
var
i
=
ref
.
r1
+
1
;
i
<=
ref
.
r2
;
i
++
)
for
(
var
i
=
ref
.
r1
+
1
;
i
<=
ref
.
r2
;
i
++
)
{
{
if
(
worksheet
.
getRowHidden
(
i
)
===
false
)
if
(
worksheet
.
getRowHidden
(
i
)
===
false
)
...
@@ -4225,6 +4284,7 @@
...
@@ -4225,6 +4284,7 @@
worksheet
.
setRowHidden
(
false
,
i
,
i
);
worksheet
.
setRowHidden
(
false
,
i
,
i
);
}
}
}
}
this
.
_waitRecalFormulasAfterTableRowHidden
(
false
);
},
},
_openAllHiddenRowsByFilter
:
function
(
filter
)
_openAllHiddenRowsByFilter
:
function
(
filter
)
...
@@ -4387,7 +4447,6 @@
...
@@ -4387,7 +4447,6 @@
if
(
null
!=
options
.
TotalsRowCount
)
if
(
null
!=
options
.
TotalsRowCount
)
totalsRowCount
=
options
.
TotalsRowCount
;
totalsRowCount
=
options
.
TotalsRowCount
;
worksheet
.
workbook
.
dependencyFormulas
.
lockRecal
();
if
(
style
&&
worksheet
.
workbook
.
TableStyles
&&
worksheet
.
workbook
.
TableStyles
.
AllStyles
)
if
(
style
&&
worksheet
.
workbook
.
TableStyles
&&
worksheet
.
workbook
.
TableStyles
.
AllStyles
)
{
{
//заполняем названия столбцов
//заполняем названия столбцов
...
@@ -4436,14 +4495,12 @@
...
@@ -4436,14 +4495,12 @@
styleForCurTable
=
worksheet
.
workbook
.
TableStyles
.
AllStyles
[
style
.
Name
];
styleForCurTable
=
worksheet
.
workbook
.
TableStyles
.
AllStyles
[
style
.
Name
];
if
(
!
styleForCurTable
)
{
if
(
!
styleForCurTable
)
{
worksheet
.
workbook
.
dependencyFormulas
.
unlockRecal
();
return
;
return
;
}
}
//заполняем стили
//заполняем стили
styleForCurTable
.
initStyle
(
worksheet
.
sheetMergedStyles
,
bbox
,
style
,
headerRowCount
,
totalsRowCount
);
styleForCurTable
.
initStyle
(
worksheet
.
sheetMergedStyles
,
bbox
,
style
,
headerRowCount
,
totalsRowCount
);
}
}
worksheet
.
workbook
.
dependencyFormulas
.
unlockRecal
();
},
},
_getFormatTableColumnRange
:
function
(
table
,
columnName
)
_getFormatTableColumnRange
:
function
(
table
,
columnName
)
...
...
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