I have a process when the event resize on the scheduler will show Sch.plugin.EditorWindow as the code below, I am wondering how can i easily reverse the time change when i click the cancel button in the EditorWindow (via a existing function etc). At moment only the browser refresh can restore the time change of the event. (please check details in the screenshot below).
You could call finalize(false) on save, and do further editing in the editor. You might need to adjust the loading of the record in the editor, because the unmodified record is passed. In that case you need to grab the start- and enddate from the dragContext and set the corresponding values in the editor start- and end date field.
You can save your time info on beforeeventresize, and set it back to the record in onCancelClick. Please keep in mind it's private function. To hook into onCancelClick, you need to specify it in editorConfig something like this:
{
ptype : 'scheduler_editorwindow',
editorConfig : {
onCancelClick : function () {
// Implement your logic here
// Hide editor window manually
this.ownerCt.hide();
}
}
}
Actually Terence's approach looks more solid to me since you don't apply changes before you press Save in Editor. However it's up to you the way to go.
I am considering to use onCancelClick to control the changes. So pmiklashevich can you please advise how can you pass the parameters from beforeeventresize to the record in onCancelClick? Thanks.
Before resize you save record.getStartDate()/record.getEndDate() in a property of your scheduler, or in a place you think fits better for this. You can save them somewhere in your editor (but clean up them when the editor gets closed). First argument in beforeeventresize is view. So calling view.getEventEditor() you can receive your event editor. So on cancel click you call record.setStartDate(savedStartDate)/record.setEndDate(savedEndDate)