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
2f9f754d
Commit
2f9f754d
authored
May 19, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete hidden rows by filter
parent
137a3557
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
22 deletions
+75
-22
cell/model/Workbook.js
cell/model/Workbook.js
+19
-11
cell/model/autofilters.js
cell/model/autofilters.js
+43
-1
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+13
-10
No files found.
cell/model/Workbook.js
View file @
2f9f754d
...
...
@@ -5509,13 +5509,17 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
}
}
};
Range
.
prototype
.
_foreachRowNoEmpty
=
function
(
actionRow
,
actionCell
){
Range
.
prototype
.
_foreachRowNoEmpty
=
function
(
actionRow
,
actionCell
,
excludeHiddenRows
){
var
oBBox
=
this
.
bbox
;
if
(
0
==
oBBox
.
r1
&&
gc_nMaxRow0
==
oBBox
.
r2
)
{
var
aRows
=
this
.
worksheet
.
_getRows
();
for
(
var
i
in
aRows
)
{
if
(
excludeHiddenRows
&&
this
.
worksheet
.
getRowHidden
(
i
))
{
continue
;
}
var
row
=
aRows
[
i
];
if
(
null
!=
actionRow
)
{
...
...
@@ -5539,6 +5543,10 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
{
var
minR
=
Math
.
min
(
oBBox
.
r2
,
this
.
worksheet
.
getRowsCount
());
for
(
var
i
=
oBBox
.
r1
;
i
<=
minR
;
i
++
){
if
(
excludeHiddenRows
&&
this
.
worksheet
.
getRowHidden
(
i
))
{
continue
;
}
var
row
=
this
.
worksheet
.
_getRowNoEmpty
(
i
);
if
(
row
)
{
...
...
@@ -5748,17 +5756,17 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
// this._foreachCol(actionCol, null);
}
};
Range
.
prototype
.
_setPropertyNoEmpty
=
function
(
actionRow
,
actionCol
,
actionCell
){
Range
.
prototype
.
_setPropertyNoEmpty
=
function
(
actionRow
,
actionCol
,
actionCell
,
excludeHiddenRows
){
var
nRangeType
=
this
.
_getRangeType
();
if
(
c_oRangeType
.
Range
==
nRangeType
)
return
this
.
_foreachNoEmpty
(
actionCell
);
return
this
.
_foreachNoEmpty
(
actionCell
,
excludeHiddenRows
);
else
if
(
c_oRangeType
.
Row
==
nRangeType
)
return
this
.
_foreachRowNoEmpty
(
actionRow
,
actionCell
);
return
this
.
_foreachRowNoEmpty
(
actionRow
,
actionCell
,
excludeHiddenRows
);
else
if
(
c_oRangeType
.
Col
==
nRangeType
)
return
this
.
_foreachColNoEmpty
(
actionCol
,
actionCell
);
else
{
var
oRes
=
this
.
_foreachRowNoEmpty
(
actionRow
,
actionCell
);
var
oRes
=
this
.
_foreachRowNoEmpty
(
actionRow
,
actionCell
,
excludeHiddenRows
);
if
(
null
!=
oRes
)
return
oRes
;
if
(
null
!=
actionCol
)
...
...
@@ -7701,7 +7709,7 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
cell
.
cleanCache
();
});
};
Range
.
prototype
.
cleanFormat
=
function
(){
Range
.
prototype
.
cleanFormat
=
function
(
excludeHiddenRows
){
History
.
Create_NewPoint
();
History
.
StartTransaction
();
this
.
unmerge
();
...
...
@@ -7717,10 +7725,10 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
cell
.
setStyle
(
null
);
// if(cell.isEmpty())
// cell.Remove();
});
}
,
excludeHiddenRows
);
History
.
EndTransaction
();
};
Range
.
prototype
.
cleanText
=
function
(){
Range
.
prototype
.
cleanText
=
function
(
excludeHiddenRows
){
History
.
Create_NewPoint
();
History
.
StartTransaction
();
this
.
_setPropertyNoEmpty
(
null
,
null
,
...
...
@@ -7728,10 +7736,10 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
cell
.
setValue
(
""
);
// if(cell.isEmpty())
// cell.Remove();
});
}
,
excludeHiddenRows
);
History
.
EndTransaction
();
};
Range
.
prototype
.
cleanAll
=
function
(){
Range
.
prototype
.
cleanAll
=
function
(
excludeHiddenRows
){
History
.
Create_NewPoint
();
History
.
StartTransaction
();
this
.
unmerge
();
...
...
@@ -7750,7 +7758,7 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
// col.Remove();
},
function
(
cell
,
nRow0
,
nCol0
,
nRowStart
,
nColStart
){
oThis
.
worksheet
.
_removeCell
(
nRow0
,
nCol0
);
});
}
,
excludeHiddenRows
);
this
.
worksheet
.
workbook
.
dependencyFormulas
.
calcTree
();
History
.
EndTransaction
();
...
...
cell/model/autofilters.js
View file @
2f9f754d
...
...
@@ -5063,6 +5063,48 @@
return
result
;
},
bIsExcludeHiddenRows
:
function
(
range
,
activeCell
)
{
var
worksheet
=
this
.
worksheet
;
var
result
=
false
;
//если есть общий фильтр со скрытыми строками, чтобы мы не удаляли на странице, данные в скрытых строках не трогаем
if
(
worksheet
.
AutoFilter
&&
worksheet
.
AutoFilter
.
isApplyAutoFilter
())
{
result
=
true
;
}
else
if
(
this
.
_getTableIntersectionWithActiveCell
(
activeCell
,
true
))
//если activeCell лежит внутри таблицы c примененным фильтром
{
result
=
true
;
}
return
result
;
},
_getTableIntersectionWithActiveCell
:
function
(
activeCell
,
checkApplyFiltering
)
{
var
result
=
false
;
var
worksheet
=
this
.
worksheet
;
if
(
worksheet
.
TableParts
&&
worksheet
.
TableParts
.
length
>
0
)
{
for
(
var
i
=
0
;
i
<
worksheet
.
TableParts
.
length
;
i
++
)
{
var
ref
=
worksheet
.
TableParts
[
i
].
Ref
;
if
(
ref
.
contains
(
activeCell
.
col
,
activeCell
.
row
))
{
if
(
checkApplyFiltering
&&
worksheet
.
TableParts
[
i
].
isApplyAutoFilter
())
{
result
=
worksheet
.
TableParts
[
i
];
break
;
}
}
}
}
return
result
;
},
_isPartAutoFilterUnderRange
:
function
(
range
)
{
var
worksheet
=
this
.
worksheet
;
...
...
cell/view/WorksheetView.js
View file @
2f9f754d
...
...
@@ -8644,26 +8644,22 @@
/* отключаем отрисовку на случай необходимости пересчета ячеек, заносим ячейку, при необходимости в список перерисовываемых */
t
.
model
.
workbook
.
dependencyFormulas
.
lockRecal
();
// Если нужно удалить автофильтры - удаляем
if
(
val
===
c_oAscCleanOptions
.
All
||
val
===
c_oAscCleanOptions
.
Text
)
{
t
.
model
.
autoFilters
.
isEmptyAutoFilters
(
arn
);
}
else
if
(
val
===
c_oAscCleanOptions
.
Format
)
{
t
.
model
.
autoFilters
.
cleanFormat
(
arn
);
}
//нужно ли удалять скрытые строки
var
excludeHiddenRows
=
t
.
model
.
autoFilters
.
bIsExcludeHiddenRows
(
arn
,
activeCell
);
switch
(
val
)
{
case
c_oAscCleanOptions
.
All
:
range
.
cleanAll
();
range
.
cleanAll
(
excludeHiddenRows
);
t
.
model
.
removeSparklines
(
arn
);
// Удаляем комментарии
t
.
cellCommentator
.
deleteCommentsRange
(
arn
);
break
;
case
c_oAscCleanOptions
.
Text
:
case
c_oAscCleanOptions
.
Formula
:
range
.
cleanText
();
range
.
cleanText
(
excludeHiddenRows
);
break
;
case
c_oAscCleanOptions
.
Format
:
range
.
cleanFormat
();
range
.
cleanFormat
(
excludeHiddenRows
);
break
;
case
c_oAscCleanOptions
.
Comments
:
t
.
cellCommentator
.
deleteCommentsRange
(
arn
);
...
...
@@ -8679,6 +8675,13 @@
break
;
}
// Если нужно удалить автофильтры - удаляем
if
(
val
===
c_oAscCleanOptions
.
All
||
val
===
c_oAscCleanOptions
.
Text
)
{
t
.
model
.
autoFilters
.
isEmptyAutoFilters
(
arn
);
}
else
if
(
val
===
c_oAscCleanOptions
.
Format
)
{
t
.
model
.
autoFilters
.
cleanFormat
(
arn
);
}
// Вызываем функцию пересчета для заголовков форматированной таблицы
if
(
val
===
c_oAscCleanOptions
.
All
||
val
===
c_oAscCleanOptions
.
Text
)
{
t
.
model
.
autoFilters
.
renameTableColumn
(
arn
);
...
...
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