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
22c543df
Commit
22c543df
authored
May 12, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add functions for top10 filter
parent
bb9f5934
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
5 deletions
+76
-5
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+73
-2
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+3
-3
No files found.
cell/model/WorkbookElems.js
View file @
22c543df
...
...
@@ -5369,6 +5369,7 @@ FilterColumn.prototype.createFilter = function(obj) {
}
case
c_oAscAutoFilterTypes
.
Top10
:
{
this
.
Top10
=
obj
.
filter
.
filter
.
clone
();
break
;
}
case
c_oAscAutoFilterTypes
.
Filters
:
...
...
@@ -5396,9 +5397,12 @@ FilterColumn.prototype.init = function(range) {
//добавляем данные, которые не передаются из меню при примененни а/ф(в данном случае только DynamicFilter)
if
(
null
!==
this
.
DynamicFilter
)
{
var
res
=
null
;
this
.
DynamicFilter
.
init
(
range
);
}
else
if
(
null
!==
this
.
Top10
)
{
this
.
Top10
.
init
(
range
);
}
};
...
...
@@ -6129,9 +6133,76 @@ Top10.prototype.clone = function() {
return
res
;
};
Top10
.
prototype
.
isHideValue
=
function
(
val
,
top10Length
)
{
return
;
var
res
=
false
;
if
(
null
!==
this
.
filterVal
)
{
if
(
this
.
Top
)
{
if
(
val
<
this
.
FilterVal
)
{
res
=
true
;
}
}
else
{
if
(
val
>
this
.
FilterVal
)
{
res
=
true
;
}
}
}
return
res
;
};
Top10
.
prototype
.
init
=
function
(
range
,
reWrite
){
var
res
=
null
;
var
t
=
this
;
if
(
null
===
this
.
FilterVal
||
true
===
reWrite
)
{
if
(
range
)
{
var
arr
=
[];
var
alreadyAddValues
=
{};
range
.
_foreach2
(
function
(
cell
){
var
val
=
parseFloat
(
cell
.
getValue
());
if
(
!
isNaN
(
val
)
&&
!
alreadyAddValues
[
val
])
{
arr
.
push
(
val
);
alreadyAddValues
[
val
]
=
1
;
}
});
if
(
arr
.
length
)
{
arr
.
sort
(
function
(
a
,
b
){
var
res
;
if
(
t
.
Top
)
{
res
=
b
-
a
;
}
else
{
res
=
a
-
b
;
}
return
res
;
});
res
=
arr
[
this
.
Val
-
1
];
}
}
}
if
(
null
!==
res
)
{
this
.
FilterVal
=
res
;
}
};
Top10
.
prototype
.
asc_getFilterVal
=
function
()
{
return
this
.
FilterVal
;
};
Top10
.
prototype
.
asc_getPercent
=
function
()
{
return
this
.
Percent
;
};
Top10
.
prototype
.
asc_getTop
=
function
()
{
return
this
.
Top
;
};
...
...
cell/view/WorksheetView.js
View file @
22c543df
...
...
@@ -12655,7 +12655,7 @@
if
(
filters
&&
filters
.
ColorFilter
)
{
filterObj
.
type
=
c_oAscAutoFilterTypes
.
ColorFilter
;
filterObj
.
filter
=
filters
.
ColorFilter
;
filterObj
.
filter
=
filters
.
ColorFilter
.
clone
()
;
}
else
if
(
filters
&&
filters
.
CustomFiltersObj
&&
filters
.
CustomFiltersObj
.
CustomFilters
)
{
...
...
@@ -12665,12 +12665,12 @@
else
if
(
filters
&&
filters
.
DynamicFilter
)
{
filterObj
.
type
=
c_oAscAutoFilterTypes
.
DynamicFilter
;
filterObj
.
filter
=
filters
.
DynamicFilter
;
filterObj
.
filter
=
filters
.
DynamicFilter
.
clone
()
;
}
else
if
(
filters
&&
filters
.
Top10
)
{
filterObj
.
type
=
c_oAscAutoFilterTypes
.
Top10
;
filterObj
.
filter
=
filters
.
Top10
;
filterObj
.
filter
=
filters
.
Top10
.
clone
()
;
}
else
if
(
filters
)
{
...
...
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