Wednesday, October 7, 2015

Disable drag and drop events in SharePoint calendars

<script type='text/javascript'> ExecuteOrDelayUntilScriptLoaded(fixupDrag, 'SP.UI.ApplicationPages.Calendar.js'); function fixupDrag(){ var calendarCreate = SP.UI.ApplicationPages.CalendarContainerFactory.create; SP.UI.ApplicationPages.CalendarContainerFactory.create = function(elem, cctx, viewType, date, startupData) { if(cctx.dataSources && cctx.dataSources instanceof Array && cctx.dataSources.length > 0){ for(var i = 0; i < cctx.dataSources.length; i++){ cctx.dataSources[i].disableDrag = true; } } calendarCreate(elem, cctx, viewType, date, startupData); } } </script>

Disable drag and drop events in SharePoint calendars

<script type='text/javascript'> ExecuteOrDelayUntilScriptLoaded(fixupDrag, 'SP.UI.ApplicationPages.Calendar.js'); function fixupDrag(){ var calendarCreate = SP.UI.ApplicationPages.CalendarContainerFactory.create; SP.UI.ApplicationPages.CalendarContainerFactory.create = function(elem, cctx, viewType, date, startupData) { if(cctx.dataSources && cctx.dataSources instanceof Array && cctx.dataSources.length > 0){ for(var i = 0; i < cctx.dataSources.length; i++){ cctx.dataSources[i].disableDrag = true; } } calendarCreate(elem, cctx, viewType, date, startupData); } } </script>