PureJS SpreadJS - Customize Ctrl + Shift + Down has error when paste data
페이지 정보
작성자 Rotterdam 작성일 2022-12-12 10:18 조회 543회 댓글 0건본문
관련링크
Hello GrapeCity Korea,
During implementing project, we are facing with an issue related to paste data.
Because spreadJs only support selection bottom when using ctrl + shift + down (image below).
So we customize this command as below:
var commandD = {
canUndo: true,
execute: function (spread, options, isUndo) {
var Commands = GC.Spread.Sheets.Commands;
if (isUndo) {
Commands.undoTransaction(spread, options);
return true;
} else {
options.cmd = "D";
Commands.startTransaction(spread, options);
spread.suspendPaint();
arrowKey(40, sheet);
spread.resumePaint();
Commands.endTransaction(spread, options);
return true;
}
}
};
var commandManager = spreadEffort.commandManager();
commandManager.register('D', commandD, 40, true, true, false, false);
function arrowKey(key, sheet) {
var arrSelection = sheet.getSelections()[0];
var rowCount = sheet.getRowCount();
var columnCount = sheet.getColumnCount();
var rowEnd = 1;
if (key == 40) {
rowEnd = 1;
var rowSelection = arrSelection.rowCount;
if (sheet.getText(arrSelection.row + rowSelection, arrSelection.col) == '') {
for (var i = arrSelection.row + rowSelection; i <= rowCount; i++) {
rowEnd += 1;
if (sheet.getText(i, arrSelection.col) != '') {
break;
}
}
sheet.addSelection(arrSelection.row, arrSelection.col, rowEnd + rowSelection -1, arrSelection.colCount);
sheet.setSelection(arrSelection.row, arrSelection.col, rowEnd + rowSelection -1, arrSelection.colCount);
}
else {
for (var i = arrSelection.row + rowSelection; i <= rowCount; i++) {
rowEnd += 1;
if (sheet.getText(i, arrSelection.col) == '') {
break;
}
}
sheet.addSelection(arrSelection.row, arrSelection.col, rowEnd - 2 + rowSelection, arrSelection.colCount);
sheet.setSelection(arrSelection.row, arrSelection.col, rowEnd - 2 + rowSelection, arrSelection.colCount);
}
}
Now, we can use ctrl + shift + down for selecting range between 2 values (image below).
But an error happen when we paste value (image below).
Please support us solve this error.
We are looking for your support.
Thank you.
댓글목록
등록된 댓글이 없습니다.