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
5e46983d
Commit
5e46983d
authored
May 10, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functions for DynamicFilter
parent
9cd91100
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
1 deletion
+120
-1
cell/apiDefines.js
cell/apiDefines.js
+42
-0
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+74
-0
cell/model/autofilters.js
cell/model/autofilters.js
+4
-1
No files found.
cell/apiDefines.js
View file @
5e46983d
...
...
@@ -147,6 +147,44 @@ var c_oAscCustomAutoFilter = {
doesNotContain
:
12
};
/** @enum */
var
c_oAscDynamicAutoFilter
=
{
aboveAverage
:
1
,
belowAverage
:
2
,
lastMonth
:
3
,
lastQuarter
:
4
,
lastWeek
:
5
,
lastYear
:
6
,
m1
:
7
,
m10
:
8
,
m11
:
9
,
m12
:
10
,
m2
:
11
,
m3
:
12
,
m4
:
13
,
m5
:
14
,
m6
:
15
,
m7
:
16
,
m8
:
17
,
m9
:
18
,
nextMonth
:
19
,
nextQuarter
:
20
,
nextWeek
:
21
,
nextYear
:
22
,
q1
:
23
,
q2
:
24
,
q3
:
25
,
q4
:
26
,
thisMonth
:
27
,
thisQuarter
:
28
,
thisWeek
:
29
,
thisYear
:
30
,
today
:
31
,
tomorrow
:
32
,
yearToDate
:
33
,
yesterday
:
34
};
var
c_oAscChangeFilterOptions
=
{
filter
:
1
,
style
:
2
...
...
@@ -376,6 +414,10 @@ var c_oAscPopUpSelectorType = {
prot
[
'
doesNotEndWith
'
]
=
prot
.
doesNotEndWith
;
prot
[
'
contains
'
]
=
prot
.
contains
;
prot
[
'
doesNotContain
'
]
=
prot
.
doesNotContain
;
window
[
'
Asc
'
][
'
c_oAscDynamicAutoFilter
'
]
=
window
[
'
Asc
'
].
c_oAscDynamicAutoFilter
=
c_oAscDynamicAutoFilter
;
prot
=
c_oAscDynamicAutoFilter
;
prot
[
'
aboveAverage
'
]
=
prot
.
aboveAverage
;
prot
[
'
belowAverage
'
]
=
prot
.
belowAverage
;
window
[
'
Asc
'
][
'
c_oAscChangeFilterOptions
'
]
=
window
[
'
Asc
'
].
c_oAscChangeFilterOptions
=
c_oAscChangeFilterOptions
;
prot
=
c_oAscChangeFilterOptions
;
prot
[
'
filter
'
]
=
prot
.
filter
;
...
...
cell/model/WorkbookElems.js
View file @
5e46983d
...
...
@@ -5320,11 +5320,21 @@ FilterColumn.prototype.isHideValue = function(val, isDateTimeFormat, top10Length
res
=
this
.
Filters
.
isHideValue
(
val
.
toLowerCase
(),
isDateTimeFormat
);
}
else
if
(
this
.
CustomFiltersObj
)
{
res
=
this
.
CustomFiltersObj
.
isHideValue
(
val
);
}
else
if
(
this
.
Top10
)
{
res
=
this
.
Top10
.
isHideValue
(
val
,
top10Length
);
}
else
if
(
this
.
ColorFilter
)
{
res
=
this
.
ColorFilter
.
isHideValue
(
cell
);
}
else
if
(
this
.
DynamicFilter
)
{
res
=
this
.
DynamicFilter
.
isHideValue
(
val
);
}
return
res
;
};
...
...
@@ -5354,6 +5364,7 @@ FilterColumn.prototype.createFilter = function(obj) {
}
case
c_oAscAutoFilterTypes
.
DynamicFilter
:
{
this
.
DynamicFilter
=
obj
.
filter
.
filter
.
clone
();
break
;
}
case
c_oAscAutoFilterTypes
.
Top10
:
...
...
@@ -5380,6 +5391,19 @@ FilterColumn.prototype.isApplyAutoFilter = function() {
return
res
;
};
FilterColumn
.
prototype
.
init
=
function
(
range
)
{
//добавляем данные, которые не передаются из меню при примененни а/ф(в данном случае только DynamicFilter)
if
(
null
!==
this
.
DynamicFilter
)
{
var
res
=
null
;
this
.
DynamicFilter
.
init
(
range
);
}
};
/** @constructor */
function
Filters
()
{
this
.
Values
=
{};
...
...
@@ -5894,6 +5918,56 @@ DynamicFilter.prototype.clone = function() {
return
res
;
};
DynamicFilter
.
prototype
.
init
=
function
(
range
)
{
var
res
=
null
;
switch
(
this
.
Type
)
{
case
Asc
.
c_oAscDynamicAutoFilter
.
aboveAverage
:
case
Asc
.
c_oAscDynamicAutoFilter
.
belowAverage
:
{
var
summ
=
0
;
var
counter
=
0
;
range_forEachCell
(
function
(
cell
){
var
val
=
parseFloat
(
cell
.
getValue
());
if
(
!
isNaN
(
val
))
{
summ
+=
parseFloat
(
val
);
counter
++
;
}
});
res
=
summ
/
counter
;
break
;
}
}
this
.
Val
=
res
;
};
DynamicFilter
.
prototype
.
isHideValue
=
function
(
val
)
{
var
res
=
false
;
switch
(
this
.
Type
)
{
case
Asc
.
c_oAscDynamicAutoFilter
.
aboveAverage
:
{
res
=
val
>
this
.
Val
?
false
:
true
;
break
;
}
case
Asc
.
c_oAscDynamicAutoFilter
.
belowAverage
:
{
res
=
val
<
this
.
Val
?
false
:
true
;
break
;
}
}
return
res
;
};
DynamicFilter
.
prototype
.
asc_getType
=
function
()
{
return
this
.
Type
;
};
DynamicFilter
.
prototype
.
asc_getVal
=
function
()
{
return
this
.
Val
;
};
DynamicFilter
.
prototype
.
asc_getMaxVal
=
function
()
{
return
this
.
MaxVal
;
};
...
...
cell/model/autofilters.js
View file @
5e46983d
...
...
@@ -516,8 +516,11 @@
{
newFilterColumn
=
autoFilter
.
addFilterColumn
();
newFilterColumn
.
ColId
=
filterObj
.
ColId
;
}
}
var
allFilterOpenElements
=
newFilterColumn
.
createFilter
(
autoFiltersObject
);
newFilterColumn
.
init
(
worksheet
.
getRange3
(
autoFilter
.
Ref
.
r1
+
1
,
filterObj
.
ColId
+
autoFilter
.
Ref
.
c1
,
autoFilter
.
Ref
.
r2
,
filterObj
.
ColId
+
autoFilter
.
Ref
.
c1
));
if
(
allFilterOpenElements
&&
autoFilter
.
FilterColumns
[
filterObj
.
index
])
{
if
(
autoFilter
.
FilterColumns
[
filterObj
.
index
].
ShowButton
!==
false
)
...
...
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