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

How to listen or get the key event in scheduler e.g. delete key

Asked by juni
5 years ago.

For example, after select an event in scheduler, once the user press DEL key from the keyboard, the event will be deleted.
This shortcut is much faster than when you use context menu.


  • juni
Answer posted by Dan Letecky [DayPilot]
5 years ago.

The Scheduler doesn't contain any element that can get focus. You can detect the Delete key for the whole page using the following code:

<script type="text/javascript">
$(document).keyup(function (e) {
    if (e.keyCode == 46) {
      var firstSelected =[0];
      dp.commandCallBack("delete", { e: firstSelected });

On the server side (ASP.NET MVC):

class Dps : DayPilotScheduler
  // ...
  protected override void OnCommand(CommandArgs e)
      switch (e.Command)
          case "delete":
              string id = (string)e.Data["e"]["id"];
              new EventManager(Controller).EventDelete(id);
Comment posted by juni
5 years ago.

Thanks Dan, it works properly now.

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