Hi,
I'm trying to implement a post copy/paste custom handler to prevent some fields from being copied (e.g. external system id, and others that should not duplicate). However when working with the onPaste event (or onBeforePaste) the records returned in the event are not the correct items, they are the original task events not the new cloned events. As a result my event handler modifies the original tasks which is bad.
Here's the code from TaskCopyPaste.js which I think is in error:
recordsToProcess = isCut
? records
: records.map((rec) => {
rec = rec.copy();
rec[me.nameField] = me.generateNewName(rec);
return rec;
});
...
/**
* Fires on the owning Gantt after a paste action is performed.
* @event paste
* @on-owner
* @param {Gantt.view.Gantt} source Owner gantt
* @param {Gantt.model.TaskModel} referenceRecord The reference task record, the clipboard task records will
* be pasted above this row.
* @param {Gantt.model.TaskModel[]} records The pasted task records
* @param {Boolean} isCut `true` if this is a cut action
*/
client.trigger("paste", { records, referenceRecord, isCut: me._isCut });
return recordsToProcess;
Shouldn't the event trigger pass "recordsToProcess" and not "records" as the first parameter?
Thanks,