DragDropCalender
A JavaScript frontend Calender which supports drag and drop
License: MIT
Installation
This module is installed via npm:
$ npm install npm install drag-drop-calender
Example
Creation
You have to register at least the onConfigureEventNode
event which handels the visual represenation of the event in the DOM.
var Calender = ;var config =startDate:startHourOfDay: 14endHourOfDay: 24canDragAndDrop: true;var calender = config;calender = config;calender;{nodeinnerHTL = eventname;return node}
Config
You can configure the calender with a map of proberties.
config.startDate
the date which represents the first date diplayed in the calender.
config.startHourOfDay
the first hour of the day diplayed in the calender.
config.endHourOfDay
the last hour of the day diplayed in the calender. Must be smaller 24.
config.canDragAndDrop
When true
it is possible to drag events to another date. Use the onValidateEvent
to validate and onUpdateEvent
to update the event.
Add events.
An event have to have at least the proberty date
and duration
. An id
proberty helps you to keep track of the event when it is updated or validated.
var event =date:duration: 80eventid: 1;calender;var events = event;calender;
Remove all events
calender;
Update event
If you use drag and drop you have to register the onUpdateEvent
event to update your model when a user changes an event.
calender;{//Update your model//event.date is the new date}
Validate event
If you use drag and drop you can register the onValidateEvent
event to validate the new event. This event is asynchronous, so pass your validation result to the callback.
calender;{service;{;}}