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
c647f2ac
Commit
c647f2ac
authored
May 17, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
functions for sort(context menu)
parent
7be9c66d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
9 deletions
+63
-9
cell/model/autofilters.js
cell/model/autofilters.js
+2
-2
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+61
-7
No files found.
cell/model/autofilters.js
View file @
c647f2ac
...
...
@@ -655,7 +655,7 @@
this
.
_resetTablePartStyle
();
History
.
EndTransaction
();
return
{
minChangeRow
:
minChangeRow
,
updateRange
:
filter
.
Ref
};
return
{
minChangeRow
:
minChangeRow
,
updateRange
:
filter
.
Ref
,
filter
:
filter
};
},
checkRemoveTableParts
:
function
(
delRange
,
tableRange
)
...
...
@@ -1703,7 +1703,7 @@
}
//в данному случае может быть захвачен а/ф, если он присутвует(надо проверить), либо нажата кнопка а/ф
if
(
curFilter
&&
(
filterRef
.
isEqual
(
activeRange
)
||
cellId
!==
''
))
if
(
curFilter
&&
(
filterRef
.
isEqual
(
activeRange
)
||
cellId
!==
''
||
activeRange
.
isOneCell
()
))
{
if
(
cellId
!==
''
&&
!
isCellIdString
)
startCol
=
filterRef
.
c1
+
cellId
;
...
...
cell/view/WorksheetView.js
View file @
c647f2ac
...
...
@@ -8877,7 +8877,7 @@
}
};
WorksheetView
.
prototype
.
setSelectionInfo
=
function
(
prop
,
val
,
onlyActive
,
isLocal
)
{
WorksheetView
.
prototype
.
setSelectionInfo
=
function
(
prop
,
val
,
onlyActive
,
isLocal
,
sortColor
)
{
// Проверка глобального лока
if
(
this
.
collaborativeEditing
.
getGlobalLock
()
)
{
return
;
...
...
@@ -9054,7 +9054,7 @@
callTrigger
=
true
;
t
.
handlers
.
trigger
(
"
slowOperation
"
,
true
);
}
t
.
cellCommentator
.
sortComments
(
range
.
sort
(
val
,
arn
.
startCol
)
);
t
.
cellCommentator
.
sortComments
(
range
.
sort
(
val
,
arn
.
startCol
,
sortColor
)
);
break
;
case
"
empty
"
:
...
...
@@ -12016,8 +12016,52 @@
if
(
false
===
isSuccess
)
{
return
;
}
var
applyFilterProps
=
t
.
model
.
autoFilters
.
reapplyAutoFilter
(
tableName
,
ar
);
//reApply
var
applyFilterProps
=
t
.
model
.
autoFilters
.
reapplyAutoFilter
(
tableName
,
ar
);
//reSort
var
filter
=
applyFilterProps
.
filter
;
if
(
filter
&&
filter
.
SortState
&&
filter
.
SortState
.
SortConditions
&&
filter
.
SortState
.
SortConditions
[
0
])
{
var
sortState
=
filter
.
SortState
;
var
sortRange
=
t
.
model
.
getRange3
(
filter
.
Ref
.
r1
,
filter
.
Ref
.
c1
,
filter
.
Ref
.
r2
,
filter
.
Ref
.
c2
);
var
startCol
=
sortState
.
SortConditions
[
0
].
Ref
.
c1
;
var
type
;
var
rgbColor
=
null
;
switch
(
sortState
.
SortConditions
[
0
].
ConditionSortBy
)
{
case
Asc
.
ESortBy
.
sortbyCellColor
:
{
type
=
Asc
.
c_oAscSortOptions
.
ByColorFill
;
rgbColor
=
sortState
.
SortConditions
[
0
].
dxf
.
fill
.
bg
;
break
;
}
case
Asc
.
ESortBy
.
sortbyFontColor
:
{
type
=
Asc
.
c_oAscSortOptions
.
ByColorFont
;
rgbColor
=
sortState
.
SortConditions
[
0
].
dxf
.
font
.
c
;
break
;
}
default
:
{
type
=
Asc
.
c_oAscSortOptions
.
ByColorFont
;
if
(
sortState
.
SortConditions
[
0
].
ConditionDescending
)
{
type
=
Asc
.
c_oAscSortOptions
.
Ascending
;
}
else
{
type
=
Asc
.
c_oAscSortOptions
.
Descending
;
}
}
}
var
sort
=
sortRange
.
sort
(
type
,
startCol
,
rgbColor
);
t
.
cellCommentator
.
sortComments
(
sort
);
}
var
rowChange
=
applyFilterProps
.
rowChange
;
var
updateRange
=
applyFilterProps
.
updateRange
;
...
...
@@ -12038,10 +12082,10 @@
var
ar
=
t
.
activeRange
.
clone
(
true
);
var
isStartRangeIntoFilterOrTable
=
t
.
model
.
autoFilters
.
isStartRangeContainIntoTableOrFilter
(
ar
);
var
isApplyAutoFilter
=
null
,
isAddAutoFilter
=
null
,
cellId
=
null
;
var
isApplyAutoFilter
=
null
,
isAddAutoFilter
=
null
,
cellId
=
null
,
isFromatTable
=
null
;
if
(
null
!==
isStartRangeIntoFilterOrTable
)
//into autofilter or format table
{
var
isFromatTable
=
!
(
-
1
===
isStartRangeIntoFilterOrTable
);
isFromatTable
=
!
(
-
1
===
isStartRangeIntoFilterOrTable
);
var
filterRef
=
isFromatTable
?
t
.
model
.
TableParts
[
isStartRangeIntoFilterOrTable
].
Ref
:
t
.
model
.
AutoFilter
.
Ref
;
cellId
=
t
.
model
.
autoFilters
.
_rangeToId
(
Asc
.
Range
(
ar
.
c1
,
filterRef
.
r1
,
ar
.
c1
,
filterRef
.
r1
));
isApplyAutoFilter
=
true
;
...
...
@@ -12054,6 +12098,7 @@
else
//without filter
{
isAddAutoFilter
=
true
;
isApplyAutoFilter
=
true
;
}
...
...
@@ -12067,7 +12112,15 @@
if
(
null
!==
isAddAutoFilter
)
{
//delete old filter
if
(
!
isFromatTable
&&
t
.
model
.
AutoFilter
&&
t
.
model
.
AutoFilter
.
Ref
)
{
t
.
model
.
autoFilters
.
isEmptyAutoFilters
(
t
.
model
.
AutoFilter
.
Ref
);
}
//add new filter
t
.
model
.
autoFilters
.
addAutoFilter
(
null
,
ar
,
null
);
//generate cellId
if
(
null
===
cellId
)
{
cellId
=
t
.
model
.
autoFilters
.
_rangeToId
(
Asc
.
Range
(
ar
.
startCol
,
t
.
model
.
AutoFilter
.
Ref
.
r1
,
ar
.
startCol
,
t
.
model
.
AutoFilter
.
Ref
.
r1
));
...
...
@@ -12141,7 +12194,8 @@
if
(
null
===
sortProps
)
{
t
.
setSelectionInfo
(
"
sort
"
,
type
);
var
rgbColor
=
color
?
new
RgbColor
((
color
.
asc_getR
()
<<
16
)
+
(
color
.
asc_getG
()
<<
8
)
+
color
.
asc_getB
())
:
null
;
t
.
setSelectionInfo
(
"
sort
"
,
type
,
null
,
null
,
rgbColor
);
}
else
if
(
false
!==
sortProps
)
{
...
...
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