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
f11395aa
Commit
f11395aa
authored
Mar 30, 2016
by
GoshaZotov
Committed by
Alexander.Trofimov
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function for insert/delete col/row into table
parent
14f219b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
2 deletions
+107
-2
cell/api.js
cell/api.js
+10
-0
cell/apiDefines.js
cell/apiDefines.js
+5
-1
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+92
-1
No files found.
cell/api.js
View file @
f11395aa
...
...
@@ -665,6 +665,16 @@ var editor;
var
ws
=
this
.
wb
.
getWorksheet
();
return
ws
.
af_changeFormatTableInfo
(
tableName
,
optionType
);
};
spreadsheet_api
.
prototype
.
asc_insertCellsInTable
=
function
(
tableName
,
optionType
)
{
var
ws
=
this
.
wb
.
getWorksheet
();
return
ws
.
af_insertCellsInTable
(
tableName
,
optionType
);
};
spreadsheet_api
.
prototype
.
asc_deleteCellsInTable
=
function
(
tableName
,
optionType
)
{
var
ws
=
this
.
wb
.
getWorksheet
();
return
ws
.
asc_deleteCellsInTable
(
tableName
,
optionType
);
};
spreadsheet_api
.
prototype
.
asc_setMobileVersion
=
function
(
isMobile
)
{
this
.
isMobileVersion
=
isMobile
;
...
...
cell/apiDefines.js
View file @
f11395aa
...
...
@@ -43,7 +43,11 @@ var c_oAscInsertOptions = {
InsertCellsAndShiftRight
:
1
,
InsertCellsAndShiftDown
:
2
,
InsertColumns
:
3
,
InsertRows
:
4
InsertRows
:
4
,
InsertTableRowAbove
:
5
,
InsertTableRowBelow
:
6
,
InsertTableColLeft
:
7
,
InsertTableColRight
:
8
};
var
c_oAscDeleteOptions
=
{
...
...
cell/view/WorksheetView.js
View file @
f11395aa
...
...
@@ -12779,7 +12779,7 @@
case
c_oAscChangeSelectionFormatTable
.
column
:
{
startCol
=
this
.
activeRange
.
c1
<
refTablePart
.
c1
?
refTablePart
.
c1
:
this
.
activeRange
.
c1
;
endCol
=
this
.
activeRange
.
c2
>
refTablePart
.
r2
?
refTablePart
.
r2
:
this
.
activeRange
.
r
2
;
endCol
=
this
.
activeRange
.
c2
>
refTablePart
.
c2
?
refTablePart
.
c2
:
this
.
activeRange
.
c
2
;
startRow
=
refTablePart
.
r1
;
endRow
=
refTablePart
.
r2
;
...
...
@@ -12824,6 +12824,97 @@
return
updateRange
;
};
WorksheetView
.
prototype
.
af_insertCellsInTable
=
function
(
tableName
,
optionType
)
{
var
t
=
this
;
var
ws
=
this
.
model
;
var
acitveRange
=
this
.
activeRange
.
clone
();
var
tablePart
=
ws
.
autoFilters
.
_getFilterByDisplayName
(
tableName
);
if
(
!
tablePart
||
(
tablePart
&&
!
tablePart
.
Ref
))
{
return
false
;
}
var
startCol
=
this
.
activeRange
.
c1
;
var
endCol
=
this
.
activeRange
.
c2
;
var
startRow
=
this
.
activeRange
.
r1
;
var
endRow
=
this
.
activeRange
.
r2
;
var
newActiveRange
=
null
;
switch
(
optionType
)
{
case
c_oAscInsertOptions
.
InsertTableRowAbove
:
{
newActiveRange
=
new
Asc
.
Range
(
tablePart
.
Ref
.
c1
,
startRow
,
tablePart
.
Ref
.
c2
,
endRow
);
break
;
}
case
c_oAscInsertOptions
.
InsertTableRowBelow
:
{
newActiveRange
=
new
Asc
.
Range
(
tablePart
.
Ref
.
c1
,
startRow
-
1
,
tablePart
.
Ref
.
c2
,
endRow
-
1
);
break
;
}
case
c_oAscInsertOptions
.
InsertTableColLeft
:
{
newActiveRange
=
new
Asc
.
Range
(
startCol
-
1
,
tablePart
.
Ref
.
r1
,
endCol
-
1
,
tablePart
.
Ref
.
r2
);
break
;
}
case
c_oAscInsertOptions
.
InsertTableColRight
:
{
newActiveRange
=
new
Asc
.
Range
(
startCol
,
tablePart
.
Ref
.
r1
,
endCol
,
tablePart
.
Ref
.
r2
);
break
;
}
}
if
(
newActiveRange
!==
null
)
{
t
.
activeRange
=
newActiveRange
;
t
.
changeWorksheet
(
"
insCell
"
);
t
.
activeRange
=
acitveRange
;
}
};
WorksheetView
.
prototype
.
af_deleteCellsInTable
=
function
(
tableName
,
optionType
)
{
var
t
=
this
;
var
ws
=
this
.
model
;
var
acitveRange
=
this
.
activeRange
.
clone
();
var
tablePart
=
ws
.
autoFilters
.
_getFilterByDisplayName
(
tableName
);
if
(
!
tablePart
||
(
tablePart
&&
!
tablePart
.
Ref
))
{
return
false
;
}
var
startCol
=
this
.
activeRange
.
c1
;
var
endCol
=
this
.
activeRange
.
c2
;
var
startRow
=
this
.
activeRange
.
r1
;
var
endRow
=
this
.
activeRange
.
r2
;
var
newActiveRange
=
null
;
switch
(
optionType
)
{
case
c_oAscInsertOptions
.
DeleteColumns
:
{
newActiveRange
=
new
Asc
.
Range
(
startCol
,
tablePart
.
Ref
.
r1
,
endCol
,
tablePart
.
Ref
.
r2
);
break
;
}
case
c_oAscInsertOptions
.
DeleteRows
:
{
newActiveRange
=
new
Asc
.
Range
(
tablePart
.
Ref
.
c1
,
startRow
,
tablePart
.
Ref
.
c2
,
endRow
);
break
;
}
}
if
(
newActiveRange
!==
null
)
{
t
.
activeRange
=
newActiveRange
;
t
.
changeWorksheet
(
"
delCell
"
);
t
.
activeRange
=
acitveRange
;
}
};
/*
* Export
* -----------------------------------------------------------------------------
...
...
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