Pages

Monday 22 August 2011

Sharepoint 2010 Calendar View All the events Expanded

By Default SharePoint shows 3 events for any date in the calendar view, if we want to show all the events then we have to use any of the following script for the same.

1)---
<script type="text/javascript">

_spBodyOnLoadFunctionNames.push("myFuncAfterLoad");

function myFuncAfterLoad() {
    var oldCalendarNotify4a = SP.UI.ApplicationPages.CalendarNotify.$4a;

    SP.UI.ApplicationPages.CalendarNotify.$4a = function () {
        oldCalendarNotify4a();
        myFuncToExpandCalendar();
    }
}

function myFuncToExpandCalendar() {
    try {
        var aTags = document.getElementsByTagName('A');
        for (i = 0; i < aTags.length; i++) {

            if ((aTags[i].evtid == "expand_collapse") && (aTags[i].innerText != "collapse")) {
                (aTags[i]).click();
            }
        }
    }
    catch (err) {
        alert(err.message);
    }
}

</script>

******************************************************************
2)
<script type="text/javascript">

_spBodyOnLoadFunctionNames.push("myFuncafterLoad");
function myFuncafterLoad(){var OldCalendarNotify4a = SP.UI.ApplicationPages.CalendarNotify.$4a;SP.UI.ApplicationPages.CalendarNotify.$4a = function (){myFunctoExpandCalendar();OldCalendarNotify4a();}}
function myFunctoExpandCalendar(){try{var aTags=document.getElementsByTagName('A');for(i=0;i<aTags.length;i++){try{if(aTags[i].evtid=="expand_collapse"){aTags[i].click();break;}}catch(err){ alert('Bad Call at' + aTags[i].href);}}}catch(err){alert(err.message);}}</script>

*********************************************************************

3)
<script type="text/javascript">

_spBodyOnLoadFunctionNames.push('WaitForCalendarToLoad');
function WaitForCalendarToLoad()
{  
    SP.UI.ApplicationPages.SummaryItemRenderer.prototype.$2u = function ()
    {
            ULSvSp: ;
            if (!this.$1A_1) this.$1A_1 = 100;
            return this.$1A_1
        }
}</script>

*******************************************************************

4)
<script type="text/javascript">

 _spBodyOnLoadFunctionNames.push('WaitForCalendarToLoad');
function WaitForCalendarToLoad()
{  
    var old$4a = SP.UI.ApplicationPages.CalendarNotify.$4a;
    SP.UI.ApplicationPages.CalendarNotify.$4a = function ()
    {
        old$4a();
        ctrl = SP.UI.ApplicationPages.CalendarInstanceRepository.firstInstance();
        if (ctrl) {
            ctrl.expandAll();
        }
    }
}</script>

********************************************************************

Reference :-- REFERENCE

Popular Posts