How to get sections name when drag and drop event from one to another (section)


Hello, I want to get the names of section (from) and section (to) while drop event to new section (I want to create prompt - "Are you sure to move this event from {section_name_from} to } {section_name_to} How to achive that?


Hello @pawelktr ,

You can do it with the onBeforeEventChanged event:

The thing that you have to do, is to compare the current section id of the event, with the section of the original one(before changes started), and show some modal. Based on the choice (yes/no) you can restore the event’s data to the original one or keep it changes.

The code may look like follows:

var fromSec;
var currSec;

scheduler.attachEvent("onBeforeEventChanged", function(ev, e, is_new, original){
  fromSec = original.section_id;
  currSec = ev.section_id;
  if(fromSec != currSec){
      text: `Do you want to move event from section ${fromSec} to ${currSec}`,
      width: "500px",
      position: "middle",
      buttons:["Nope", "Yes" ],
      callback: function(index) {
        switch(+index) {
          case 0:
			ev.section_id = original.section_id;
            ev.start_date = original.start_date;
            ev.end_date = original.end_date;
          case 1:
  return true;

Here is a demo:


Thank you for your reply, great tip and answer :ok_hand: