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
c41f33f1
Commit
c41f33f1
authored
Sep 14, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify WorksheetView.prototype.addAutoFilter
parent
bc659c1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
72 deletions
+83
-72
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+83
-72
No files found.
cell/view/WorksheetView.js
View file @
c41f33f1
...
...
@@ -11851,74 +11851,66 @@
this
.
arrActiveFormulaRanges
=
[];
};
WorksheetView
.
prototype
.
addAutoFilter
=
function
(
styleName
,
addFormatTableOptionsObj
)
{
// Проверка глобального лока
if
(
this
.
collaborativeEditing
.
getGlobalLock
())
{
return
;
}
if
(
!
this
.
handlers
.
trigger
(
"
getLockDefNameManagerStatus
"
))
{
this
.
handlers
.
trigger
(
"
onErrorEvent
"
,
c_oAscError
.
ID
.
LockCreateDefName
,
c_oAscError
.
Level
.
NoCritical
);
return
;
}
var
t
=
this
;
var
ar
=
this
.
model
.
selectionRange
.
getLast
().
clone
();
WorksheetView
.
prototype
.
addAutoFilter
=
function
(
styleName
,
addFormatTableOptionsObj
)
{
// Проверка глобального лока
if
(
this
.
collaborativeEditing
.
getGlobalLock
())
{
return
;
}
var
isChangeAutoFilterToTablePart
=
function
(
addFormatTableOptionsObj
)
{
var
res
=
false
;
var
worksheet
=
t
.
model
;
if
(
!
this
.
handlers
.
trigger
(
"
getLockDefNameManagerStatus
"
))
{
this
.
handlers
.
trigger
(
"
onErrorEvent
"
,
c_oAscError
.
ID
.
LockCreateDefName
,
c_oAscError
.
Level
.
NoCritical
);
return
;
}
var
activeRange
=
AscCommonExcel
.
g_oRangeCache
.
getAscRange
(
addFormatTableOptionsObj
.
asc_getRange
());
if
(
activeRange
&&
worksheet
.
AutoFilter
&&
activeRange
.
containsRange
(
worksheet
.
AutoFilter
.
Ref
)
&&
activeRange
.
r1
===
worksheet
.
AutoFilter
.
Ref
.
r1
)
{
res
=
true
;
}
var
t
=
this
;
var
ar
=
this
.
model
.
selectionRange
.
getLast
().
clone
();
return
res
;
};
var
isChangeAutoFilterToTablePart
=
function
(
addFormatTableOptionsObj
)
{
var
res
=
false
;
var
worksheet
=
t
.
model
;
var
onChangeAutoFilterCallback
=
function
(
isSuccess
)
{
if
(
false
===
isSuccess
)
{
t
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onError
"
,
c_oAscError
.
ID
.
LockedAllError
,
c_oAscError
.
Level
.
NoCritical
);
t
.
handlers
.
trigger
(
"
selectionChanged
"
);
return
;
}
var
activeRange
=
AscCommonExcel
.
g_oRangeCache
.
getAscRange
(
addFormatTableOptionsObj
.
asc_getRange
());
if
(
activeRange
&&
worksheet
.
AutoFilter
&&
activeRange
.
containsRange
(
worksheet
.
AutoFilter
.
Ref
)
&&
activeRange
.
r1
===
worksheet
.
AutoFilter
.
Ref
.
r1
)
{
res
=
true
;
}
var
addFilterCallBack
,
addNameColumn
,
filterRange
;
if
(
addFormatTableOptionsObj
&&
isChangeAutoFilterToTablePart
(
addFormatTableOptionsObj
)
===
true
)
//CHANGE FILTER TO TABLEPART
{
filterRange
=
t
.
model
.
AutoFilter
.
Ref
.
clone
();
return
res
;
};
addFilterCallBack
=
function
()
{
History
.
Create_NewPoint
();
History
.
StartTransaction
();
var
filterRange
,
bIsChangeFilterToTable
,
addNameColumn
;
var
onChangeAutoFilterCallback
=
function
(
isSuccess
)
{
if
(
false
===
isSuccess
)
{
t
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onError
"
,
c_oAscError
.
ID
.
LockedAllError
,
c_oAscError
.
Level
.
NoCritical
);
t
.
handlers
.
trigger
(
"
selectionChanged
"
);
return
;
}
t
.
model
.
autoFilters
.
changeAutoFilterToTablePart
(
styleName
,
ar
,
addFormatTableOptionsObj
);
t
.
_onUpdateFormatTable
(
filterRange
,
!!
(
styleName
),
true
);
var
addFilterCallBack
;
if
(
bIsChangeFilterToTable
)
//CHANGE FILTER TO TABLEPART
{
addFilterCallBack
=
function
()
{
History
.
Create_NewPoint
();
History
.
StartTransaction
();
History
.
EndTransaction
(
);
}
;
t
.
model
.
autoFilters
.
changeAutoFilterToTablePart
(
styleName
,
ar
,
addFormatTableOptionsObj
);
t
.
_onUpdateFormatTable
(
filterRange
,
!!
(
styleName
),
true
)
;
addNameColumn
=
false
;
if
(
addFormatTableOptionsObj
===
false
)
{
addNameColumn
=
true
;
}
else
if
(
typeof
addFormatTableOptionsObj
==
'
object
'
)
{
addNameColumn
=
!
addFormatTableOptionsObj
.
asc_getIsTitle
();
}
if
(
addNameColumn
)
{
filterRange
.
r2
=
filterRange
.
r2
+
1
;
}
History
.
EndTransaction
();
};
t
.
_isLockedCells
(
filterRange
,
/*subType*/
null
,
addFilterCallBack
);
}
else
//ADD
if
(
addNameColumn
)
{
filterRange
.
r2
=
filterRange
.
r2
+
1
;
}
t
.
_isLockedCells
(
filterRange
,
/*subType*/
null
,
addFilterCallBack
);
}
else
//ADD
{
addFilterCallBack
=
function
()
{
History
.
Create_NewPoint
();
History
.
StartTransaction
();
if
(
null
!==
styleName
)
{
if
(
null
!==
styleName
)
{
t
.
handlers
.
trigger
(
"
slowOperation
"
,
true
);
}
...
...
@@ -11931,33 +11923,52 @@
}
t
.
_onUpdateFormatTable
(
filterRange
,
!!
(
styleName
),
true
);
if
(
null
!==
styleName
)
{
if
(
null
!==
styleName
)
{
t
.
handlers
.
trigger
(
"
slowOperation
"
,
false
);
}
History
.
EndTransaction
();
};
if
(
styleName
===
null
)
{
addFilterCallBack
();
}
else
{
var
filterInfo
=
t
.
model
.
autoFilters
.
_getFilterInfoByAddTableProps
(
ar
,
addFormatTableOptionsObj
);
filterRange
=
filterInfo
.
filterRange
;
addNameColumn
=
filterInfo
.
addNameColumn
;
if
(
styleName
===
null
)
{
addFilterCallBack
();
}
else
{
t
.
_isLockedCells
(
filterRange
,
null
,
addFilterCallBack
)
}
}
};
t
.
_isLockedCells
(
filterRange
,
null
,
addFilterCallBack
)
}
}
};
//calculate filter range
if
(
addFormatTableOptionsObj
&&
isChangeAutoFilterToTablePart
(
addFormatTableOptionsObj
)
===
true
)
{
filterRange
=
t
.
model
.
AutoFilter
.
Ref
.
clone
();
if
(
t
.
_checkAddAutoFilter
(
ar
,
styleName
,
addFormatTableOptionsObj
)
===
true
)
{
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
this
.
_isLockedDefNames
(
null
,
null
);
}
else
//для того, чтобы в случае ошибки кнопка отжималась!
{
t
.
handlers
.
trigger
(
"
selectionChanged
"
);
}
};
addNameColumn
=
false
;
if
(
addFormatTableOptionsObj
===
false
)
{
addNameColumn
=
true
;
}
else
if
(
typeof
addFormatTableOptionsObj
==
'
object
'
)
{
addNameColumn
=
!
addFormatTableOptionsObj
.
asc_getIsTitle
();
}
bIsChangeFilterToTable
=
true
;
}
else
{
if
(
styleName
===
null
)
{
filterRange
=
ar
;
}
else
{
var
filterInfo
=
t
.
model
.
autoFilters
.
_getFilterInfoByAddTableProps
(
ar
,
addFormatTableOptionsObj
,
true
);
filterRange
=
filterInfo
.
filterRange
;
addNameColumn
=
filterInfo
.
addNameColumn
;
}
}
var
checkFilterRange
=
filterInfo
?
filterInfo
.
rangeWithoutDiff
:
filterRange
;
if
(
t
.
_checkAddAutoFilter
(
checkFilterRange
,
styleName
,
addFormatTableOptionsObj
)
===
true
)
{
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
this
.
_isLockedDefNames
(
null
,
null
);
}
else
//для того, чтобы в случае ошибки кнопка отжималась!
{
t
.
handlers
.
trigger
(
"
selectionChanged
"
);
}
};
WorksheetView
.
prototype
.
changeAutoFilter
=
function
(
tableName
,
optionType
,
val
)
{
// Проверка глобального лока
...
...
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