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
75fc3337
Commit
75fc3337
authored
May 17, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add api function asc_reapplyAutoFilter
parent
753d59b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
0 deletions
+118
-0
cell/api.js
cell/api.js
+6
-0
cell/model/autofilters.js
cell/model/autofilters.js
+90
-0
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+22
-0
No files found.
cell/api.js
View file @
75fc3337
...
@@ -557,6 +557,11 @@ var editor;
...
@@ -557,6 +557,11 @@ var editor;
var
ws
=
this
.
wb
.
getWorksheet
();
var
ws
=
this
.
wb
.
getWorksheet
();
ws
.
applyAutoFilterByType
(
autoFilterObject
);
ws
.
applyAutoFilterByType
(
autoFilterObject
);
};
};
spreadsheet_api
.
prototype
.
asc_reapplyAutoFilter
=
function
(
displayName
)
{
var
ws
=
this
.
wb
.
getWorksheet
();
ws
.
asc_reapplyAutoFilter
(
displayName
);
};
spreadsheet_api
.
prototype
.
asc_sortColFilter
=
function
(
type
,
cellId
,
displayName
,
color
)
{
spreadsheet_api
.
prototype
.
asc_sortColFilter
=
function
(
type
,
cellId
,
displayName
,
color
)
{
var
ws
=
this
.
wb
.
getWorksheet
();
var
ws
=
this
.
wb
.
getWorksheet
();
...
@@ -3337,6 +3342,7 @@ var editor;
...
@@ -3337,6 +3342,7 @@ var editor;
prot
[
"
asc_changeAutoFilter
"
]
=
prot
.
asc_changeAutoFilter
;
prot
[
"
asc_changeAutoFilter
"
]
=
prot
.
asc_changeAutoFilter
;
prot
[
"
asc_applyAutoFilter
"
]
=
prot
.
asc_applyAutoFilter
;
prot
[
"
asc_applyAutoFilter
"
]
=
prot
.
asc_applyAutoFilter
;
prot
[
"
asc_applyAutoFilterByType
"
]
=
prot
.
asc_applyAutoFilterByType
;
prot
[
"
asc_applyAutoFilterByType
"
]
=
prot
.
asc_applyAutoFilterByType
;
prot
[
"
asc_reapplyAutoFilter
"
]
=
prot
.
asc_reapplyAutoFilter
;
prot
[
"
asc_sortColFilter
"
]
=
prot
.
asc_sortColFilter
;
prot
[
"
asc_sortColFilter
"
]
=
prot
.
asc_sortColFilter
;
prot
[
"
asc_getAddFormatTableOptions
"
]
=
prot
.
asc_getAddFormatTableOptions
;
prot
[
"
asc_getAddFormatTableOptions
"
]
=
prot
.
asc_getAddFormatTableOptions
;
prot
[
"
asc_clearFilter
"
]
=
prot
.
asc_clearFilter
;
prot
[
"
asc_clearFilter
"
]
=
prot
.
asc_clearFilter
;
...
...
cell/model/autofilters.js
View file @
75fc3337
...
@@ -606,6 +606,81 @@
...
@@ -606,6 +606,81 @@
return
{
minChangeRow
:
minChangeRow
,
rangeOldFilter
:
rangeOldFilter
};
return
{
minChangeRow
:
minChangeRow
,
rangeOldFilter
:
rangeOldFilter
};
},
},
reapplyAutoFilter
:
function
(
tableName
,
ar
)
{
var
worksheet
=
this
.
worksheet
;
var
bUndoChanges
=
worksheet
.
workbook
.
bUndoChanges
;
var
bRedoChanges
=
worksheet
.
workbook
.
bRedoChanges
;
//**get filter**
var
filter
=
this
.
_getFilterByDisplayName
(
displayName
);
var
autoFilter
=
filter
&&
filter
.
getType
()
===
g_nFiltersType
.
tablePart
?
filter
.
AutoFilter
:
filter
;
var
colId
=
this
.
_getColIdColumnByRange
(
filter
,
ar
);
var
index
=
this
.
_getIndexByColId
(
autoFilter
,
colId
);
if
(
filterObj
.
filter
===
null
)
return
;
History
.
Create_NewPoint
();
History
.
StartTransaction
();
//open/close rows
if
(
!
bUndoChanges
&&
!
bRedoChanges
)
{
var
hiddenObj
=
{
start
:
filter
.
Ref
.
r1
+
1
,
h
:
null
};
var
startRow
=
autoFilter
&&
autoFilter
.
Ref
?
autoFilter
.
Ref
.
r1
+
1
:
filter
.
Ref
.
r1
+
1
;
var
endRow
=
autoFilter
&&
autoFilter
.
Ref
?
autoFilter
.
Ref
.
r2
:
filter
.
Ref
.
r2
;
for
(
var
i
=
startRow
;
i
<=
endRow
;
i
++
)
{
var
isHidden
=
false
;
if
(
autoFilter
.
FilterColumns
&&
autoFilter
.
FilterColumns
.
length
)
isHidden
=
this
.
_hiddenAnotherFilter
(
autoFilter
.
FilterColumns
,
colId
,
i
,
autoFilter
.
Ref
.
c1
);
if
(
!
isHidden
)
{
var
cell
=
worksheet
.
getCell3
(
i
,
colId
+
autoFilter
.
Ref
.
c1
);
var
isDateTimeFormat
=
cell
.
getNumFormat
().
isDateTimeFormat
();
var
currentValue
=
isDateTimeFormat
?
cell
.
getValueWithoutFormat
()
:
cell
.
getValueWithFormat
();
var
isSetHidden
=
newFilterColumn
.
isHideValue
(
currentValue
,
isDateTimeFormat
,
null
,
cell
);
if
(
isSetHidden
!==
worksheet
.
getRowHidden
(
i
)
&&
minChangeRow
===
null
)
minChangeRow
=
i
;
//скрываем строки
if
(
hiddenObj
.
h
===
null
)
{
hiddenObj
.
h
=
isSetHidden
;
hiddenObj
.
start
=
i
;
}
else
if
(
hiddenObj
.
h
!==
isSetHidden
)
{
worksheet
.
setRowHidden
(
hiddenObj
.
h
,
hiddenObj
.
start
,
i
-
1
);
hiddenObj
.
h
=
isSetHidden
;
hiddenObj
.
start
=
i
;
}
if
(
i
===
endRow
)
{
worksheet
.
setRowHidden
(
hiddenObj
.
h
,
hiddenObj
.
start
,
i
);
}
}
else
if
(
hiddenObj
.
h
!==
null
)
{
worksheet
.
setRowHidden
(
hiddenObj
.
h
,
hiddenObj
.
start
,
i
-
1
);
hiddenObj
.
h
=
null
}
}
}
this
.
_resetTablePartStyle
();
History
.
EndTransaction
();
},
checkRemoveTableParts
:
function
(
delRange
,
tableRange
)
checkRemoveTableParts
:
function
(
delRange
,
tableRange
)
{
{
var
result
=
true
,
firstRowRange
;
var
result
=
true
,
firstRowRange
;
...
@@ -2535,6 +2610,21 @@
...
@@ -2535,6 +2610,21 @@
return
res
;
return
res
;
},
},
_getColIdColumnByRange
:
function
(
filter
,
range
)
{
var
res
=
null
;
var
autoFilter
=
filter
&&
filter
.
getType
()
===
g_nFiltersType
.
tablePart
?
filter
.
AutoFilter
:
filter
;
if
(
autoFilter
&&
autoFilter
.
FilterColumns
&&
autoFilter
.
FilterColumns
.
length
)
{
var
colId
=
range
.
colStart
-
autoFilter
.
Ref
.
c1
;
res
=
this
.
_getTrueColId
(
filter
,
colId
);
}
return
res
;
},
_getIndexByColId
:
function
(
autoFilter
,
colId
)
_getIndexByColId
:
function
(
autoFilter
,
colId
)
{
{
var
res
=
null
;
var
res
=
null
;
...
...
cell/view/WorksheetView.js
View file @
75fc3337
...
@@ -12009,6 +12009,28 @@
...
@@ -12009,6 +12009,28 @@
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
};
};
WorksheetView
.
prototype
.
reapplyAutoFilter
=
function
(
tableName
)
{
var
t
=
this
;
var
ar
=
t
.
activeRange
.
clone
(
true
);
var
onChangeAutoFilterCallback
=
function
(
isSuccess
)
{
if
(
false
===
isSuccess
)
{
return
;
}
t
.
model
.
autoFilters
.
reapplyAutoFilter
(
tableName
,
ar
);
if
(
null
!==
rangeOldFilter
&&
!
t
.
model
.
workbook
.
bUndoChanges
&&
!
t
.
model
.
workbook
.
bRedoChanges
)
{
t
.
_onUpdateFormatTable
(
rangeOldFilter
,
false
,
true
);
}
if
(
null
!==
rowChange
)
{
t
.
objectRender
.
updateSizeDrawingObjects
(
{
target
:
c_oTargetType
.
RowResize
,
row
:
rowChange
}
);
}
};
this
.
_isLockedAll
(
onChangeAutoFilterCallback
);
};
WorksheetView
.
prototype
.
applyAutoFilterByType
=
function
(
autoFilterObject
)
{
WorksheetView
.
prototype
.
applyAutoFilterByType
=
function
(
autoFilterObject
)
{
var
t
=
this
;
var
t
=
this
;
var
ar
=
t
.
activeRange
.
clone
(
true
);
var
ar
=
t
.
activeRange
.
clone
(
true
);
...
...
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