Skip to content

Instantly share code, notes, and snippets.

@vaderj
Created June 27, 2018 16:20
Show Gist options
  • Save vaderj/e70330b449dd2e727dd293c5ee0c7efd to your computer and use it in GitHub Desktop.
Save vaderj/e70330b449dd2e727dd293c5ee0c7efd to your computer and use it in GitHub Desktop.
Disable the double click event listeners for the SharePoint calendar (that creates a new item) #Javascript #SharePoint
//Disable the dblclick event listener which creates a new item on the calendar
ExecuteOrDelayUntilScriptLoaded(MyCalendarHook,'SP.UI.ApplicationPages.Calendar.js');
function MyCalendarHook(){
var calendarCreate = SP.UI.ApplicationPages.CalendarContainerFactory.create;
SP.UI.ApplicationPages.CalendarContainerFactory.create = function (elem,cctx,viewType,date,startupData) {
cctx.canUserCreateItem = false;
calendarCreate(elem, cctx, viewType, date, startupData);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment