Update an event by dropping an external event

吃可爱长大的小学妹 提交于 2019-12-12 10:17:16

问题


fullcalendar 1.4.7 allow adding new events by dropping them onto the calendar from an external list of events. I would like to update the title of an existing event by dropping another event from the same list. How i can do that. I wrote this function (below) and i call it from the "bindSegHandlers" function of fullcalendar.js but it doesn't work, a new event is created.

 function droppableEvent(event, eventElement) {
  eventElement.droppable({
   accept: '.myevent',
   tolerance: 'pointer',
   activeClass: 'ui-state-hover',
   hoverClass: 'ui-state-active',
   drop: function(ev, ui) {
    alert('call dropped');
   }
  });
 }

Can you help me?

thanks


回答1:


I found the solution by myself: eventRender is the right place for that!

  $('#calendar').fullCalendar({
    eventRender: function(evt, element) {
      element.droppable({
        accept: '.myevent',
        tolerance: 'pointer',
        activeClass: 'ui-state-hover',
        hoverClass: 'ui-state-active',
        drop: function(ev, ui) {
          alert('call dropped'); 
        }
      });
    },
    ....
    ....
  });

it is not necessary to modify fullcalendar.js




回答2:


It may not be a direct answer to your question but you can consider it as an alternative option. I have used another jQuery based calendar plugin named Calendario and its pretty easy to add events in it.

Calendario

Github Repo



来源:https://stackoverflow.com/questions/3366654/update-an-event-by-dropping-an-external-event

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!