Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for page being cleared when using copy and paste with selectEditor #836

Merged
merged 2 commits into from
Dec 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ export class SlickCellExternalCopyManager {
// if a custom getter is not defined, we call serializeValue of the editor to serialize
if (columnDef) {
if (columnDef.editor) {
const tmpP = document.createElement('p');
const editor = new (columnDef as any).editor({
container: document.createElement('p'), // a dummy container
container: tmpP, // a dummy container
column: columnDef,
event,
position: { top: 0, left: 0 }, // a dummy position required by some editors
Expand All @@ -119,6 +120,7 @@ export class SlickCellExternalCopyManager {
editor.loadValue(item);
retVal = editor.serializeValue();
editor.destroy();
tmpP.remove();
} else {
retVal = item[columnDef.field || ''];
}
Expand All @@ -135,15 +137,17 @@ export class SlickCellExternalCopyManager {

// if a custom setter is not defined, we call applyValue of the editor to unserialize
if (columnDef.editor) {
const tmpDiv = document.createElement('div');
const editor = new (columnDef as any).editor({
container: document.body, // a dummy container
container: tmpDiv, // a dummy container
column: columnDef,
position: { top: 0, left: 0 }, // a dummy position required by some editors
grid: this._grid
});
editor.loadValue(item);
editor.applyValue(item, value);
editor.destroy();
tmpDiv.remove();
} else {
item[columnDef.field] = value;
}
Expand Down