Our powerful JS Calendar component
Hello everyone, is there a way to subscribe on delete button click for recurrence event?
For example i need to call my own function when user delete event. See image below:
https://drive.google.com/file/d/1TuBNhZ1gDk_V89LNip8qWZEyo6NW9jJZ/view?usp=sharing
For single event I subscribe like this:
listeners: {beforeeventdelete: onEventDelete}
But it doesn't work for recurrence events because of pop up window fires my event when on opening.
Could someone help me, please?
To implement custom handlers of the buttons of the RecurrenceConfirmationPopup you need to override this class.
Add the following code in your app (or in our recurrence demo ):
import Override from '../../lib/Core/mixin/Override.js';
import RecurrenceConfirmationPopup from '../../lib/Scheduler/view/recurrence/RecurrenceConfirmationPopup.js';
class RecurrenceConfirmationPopupOverride extends Override {
static get target() {
return {
class : RecurrenceConfirmationPopup,
product : 'calendar'
};
}
onChangeMultipleButtonClick() {
console.log('onChangeMultipleButtonClick');
this.processMultipleRecords();
this.hide();
}
onChangeSingleButtonClick() {
console.log('onChangeSingleButtonClick');
this.processSingleRecord();
this.hide();
}
onCancelButtonClick() {
console.log('onCancelButtonClick');
this.cancelFn && this.cancelFn.call(this.thisObj);
this.hide();
}
}
Override.apply(RecurrenceConfirmationPopupOverride);
The above sample contains copies of the original handlers with console.log
added – you would replace these with your code.
Is there a way to do it without overriding original events(I need their functionality). Maybe I can just listen for these 3 events, and call my function when are fired?
Take a look at the source starting from line 60 please. Here we do not listen to events but we specify onClick
function. That is the function you'll override above. The original functionality is easy to achieve, just by calling the original methods such as processSingleRecord()
. The above sample does just that, only adding console logs.
Currently there is no easier/other way to do it.
Hi marland,
I do not see Override.js and RecurrenceConfirmationPopup.js.
The guide you showed says:
From your scripts you can access our classes in the global bryntum namespace
So, no need to import, just use global bryntum namespace:
class RecurrenceConfirmationPopupOverride extends bryntum.calendar.Override {
static get target() {
return {
class : bryntum.calendar.RecurrenceConfirmationPopup,
product : 'calendar'
};
}
Thanks, it's work!
Tell me please, how can I subscribe on delete button click single event (not recurrence)?
Now I am using like this:
listeners: {
beforeeventdelete: onEventDelete
},
But it fires for all events before they were deleted.