Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1095
In need of desperate help!
posted

I am using WebMonthView and WebScheduleInfo.  I am pulling the information from the database and it is loading correctly.

What I need to do is to click on a day in the calendar control.  

Once I click on the day here is the information I need to have access to.

The current Date, so if I click on the 14th of November, I will need to have that date.

I need to know if that date has any activities/appointments scheduled.

I need to know how many appointment/activities are scheduled.

And I will need a way to loop through each appointment.  

Bonus if this is possible! (no where near as important as the items above however)

Is it possible to see which button was clicked (Left/Right) and to see if this click resulted from a mobile phone or a tablet?

Parents
  • 37874
    Verified Answer
    posted

    Hi OmegaPrime,

    This can be achieved using the ActiveDayChanged client-side event, for example:

    Code Snippet
    1. function onActiveDayChanged(scheduleInfo, e, newDate) {
    2.     var activities = scheduleInfo.getActivities();
    3.     //Gets the selected date
    4.     var currentDate = newDate;
    5.     var cDay = currentDate.getDate();
    6.     var cMonth = currentDate.getMonth();
    7.     var cYear = currentDate.getFullYear();
    8.  
    9.     var currentDayActivitiesCount = 0;
    10.     var currentDayActivities = new Array();
    11.  
    12.     //Loop through all activities and check if there are some on the current date
    13.     for (var i = 0; i < activities.length; i++) {
    14.         if (activities.getItem(i).getStartDateTime().getFullYear() == cYear
    15.             && activities.getItem(i).getStartDateTime().getMonth() == cMonth
    16.             && activities.getItem(i).getStartDateTime().getDate() == cDay) {
    17.  
    18.             currentDayActivitiesCount++;
    19.             currentDayActivities.push(activities.getItem(i));
    20.         }
    21.     }
    22.  
    23.     alert(currentDayActivitiesCount);
    24.  
    25.     //If there are activities on the selected day, loop through them
    26.     if (currentDayActivitiesCount != 0) {
    27.         for (var i = 0; i < currentDayActivities.length; i++) {
    28.             console.log(currentDayActivities[i].getDescription());
    29.         }
    30.     }
    31. }

    You can get the button which is clicked in MouseDown event:

    Code Snippet
    1. var mButtonClicked;
    2. function onMouseDown(oWebMonthView, oEvent, element) {
    3.     mButtonClicked = oEvent.event.button;
    4. }

    It should be “0” for left and “2” for right mouse button.

    To check if the page is viewed from mobile device, you could use the navigator.userAgent property. Here is an article which may be helpful - http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx.

     

    Please let me know if this helps.

Reply Children