search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Deleting Event - Scheduler Pro, Using active area delete icon

Asked by Dave Linderman
10 years ago.

Hello- I'm using daypilot pro, scheduler. I have an active area set up for deleting events, however for some reason the function is not triggered by pressing the delete icon. It gets removed from the display, but when i reload it comes back.

I have set the following before calling dp.init():

dp.eventDeleteHandling = "Update";

dp.onEventDelete = function(args) {
if (!confirm("Are you sure you wish delete this event?")) {
args.preventDefault();
}
};

dp.onEventDeleted = function (args) {
DayPilot.request("events_delete.php",
function(req) { // success
var response = eval("(" + req.responseText + ")");
if (response && response.result) {
dp.message("Deleted: " + response.message);
}
},
args,
function(req) { // error
dp.message("Delete failed");
}
);
};

events_delete.php removes the event from the DB table. I currently use the same idea for moving, creating and resizing events and they work fine.

Clearly, i'm doing something wrong, and any help would be much appreciated.

Thanks!

Dave

Comment posted by Dave Linderman
10 years ago.

additional info:

I used onBeforeEventRender to enable the active area as follows:

dp.eventDeleteHandling = "Update²;

dp.onBeforeEventRender = function(args) {
args.e.areas = [{"action":"JavaScript","js":"(function(e) {
dp.events.remove(e);
})","bottom":9,"w":17,"v":"Hover","css":"event_action_delete","top":3,"righ
t":2}];
};

Comment posted by Tim
10 years ago.

Can you show me the delete.php file.

Answer posted by Dave
10 years ago.

Found the issue, per a recommendation from Dan-

When using eventDeleteHandling = Update, the active area is automatically created and BeforeEventRender is not necessary. In my case, it was prohibiting the desired function call when the delete icon was pressed.

I removed onBeforeEventRender and the delete active area worked perfectly.

The only other thing I had to verify was that I had the most recent css theme to make the delete icon appear properly.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.