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

ContextMenu - confirmdelete

Asked by Erik
9 years ago.

I have seen the tutorials for confirming delete fra asp. But it does not seem to apply for java-version, or most likely there is just some little tweek i have not found yet.
This is my code:
dps.contextMenu = new DayPilot.Menu([
{text:"Show event ID", onclick: function() {
alert("Event value: " + this.source.value());
} },
{text:"Slett", command:"delete", onclick: function() {
if(confirm('Er du sikker?')){
dps.eventMenuClickCallBack(this.e, 'delete', this.source());
}
} },
{text:"CallBack: Delete this event", command: "delete" }
]);

The callback without confirmation works fine. But with confirmation it does not work at all. Apparently i am sending the wrong parameters to dps.eventMenuClickCallBack. I have tried a lot of different parameters, but i cant find the correct combination.

Some pointers would be nice:)

Answer posted by Dan Letecky [DayPilot]
9 years ago.

It should look like this:

dps.contextMenu = new DayPilot.Menu([
        { text:"Delete", 
          onclick: function() {
            if(confirm('Are you sure?')){
                dps.eventMenuClickCallBack(this.source, 'delete');
            }
          }
        }
    ]);

I've updated the API documentation:
http://api.daypilot.org/daypilot-scheduler-eventmenuclickcallback/

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