I am trying to create a context menu on a single click. I have the code ready to implement this. However I am trying to find out the right object/events to use.
Lets say one day has an appointment set, and one day does not. What event can I use or what objects can I use through Javascript to see if the day that was just clicked on has an appointment set?
Here is the current event I am using, which works, but when I click on an appointment nothing fires.
function WebScheduleInfo1_ActiveDayChanging(oScheduleInfo, oEvent, oOldDate, oNewDate) { console.log(oScheduleInfo); console.log(oEvent); console.log(oOldDate); console.log(oNewDate);
}
Which object will hold the value of weather an appointment is set that day or not?
Anyone have any ideas?
Hi OmegaPrime,
If you are using WebMonthView, I would suggest you to handle its MouseDown event and see if the clicked element is empty, If it is, then there is no appointments on this date. For example:
function onMouseDown(oWebMonthView, oEvent, element) { if (element.children.length == 0) { console.log("No appointment"); }}
Let me know if this helps.
Is there a way to do it from the WebScheduleInfo? Or will I need to use the MouseDown event of WebMonthView and the WebScheduleInfo? I need some information from the WebScheduleInfo and on top of that information I also need to know if there is an activity present on the day that is being clicked.
So essentially I guess I need the object the WebScheduleInfo has as well as the WebMonthView. Is there a way to grab all of the information I need (The start/new date, the end/old date, as well as if an activity is present on the day clicked)
Must I use both controls to gather that data, or is there a way to gather it from just one control?
It seems that it is not possible to get all this data client-side. You can get all activities in the Click event of WebMonthView:
var activities = arguments[0].getWebScheduleInfo().getActivities();
Also, you can get the selected activity, but this would only work if you click on the activity itself:
var selectedActivity = arguments[0].getSelectedActivity();
var startDateTime = arguments[0].getSelectedActivity().getStartDateTime();
var duration = arguments[0].getSelectedActivity().getStartDateTime();
Please let me know if you have any further questions.
I ran into another issue. You suggested earlier to use the MouseDown event of the WebMonthView. I was able to get this working, however when I click on the activity it self it does not think there is an activity.
Also when I click on a specific day, the block right above where an activity would be, the same block that lists the day. It does not recognize an activity for that day. Am I missing something that would have these instances verify if an activity is present?
var $bHasActivity = false;
function WebWebMonthView_MouseDown(oWebMonthView, oEvent, element) { if (element.children.length == 0) { $bHasActivity = false; } else { $bHasActivity = true; } }
It is returning false if I click on the activity itself or in the header section of the day that contains the day of the month information. Hope that makes sense!
Any one able to help on this issue?
Hello,
If you need any further assistance with the matter, please feel free to contact me.
You could check what element is clicked from the MouseDown event and then access it in ActiveDayChanged. If it is not a button, execute your code. For example:
var el;function onMouseDown(oWebMonthView, oEvent, element) { el = element;}
function onActiveDayChanged(scheduleInfo, e, newDate) { if (el.tagName != "BUTTON") {...}
Hope this helps.
To expand on this bug further, when you click the Previous Month or Next Month button, this event fires and is popping up my context menu. There has to be a way to prevent at least that from happening?
Is there no way around this? No way to check if the click resulted on a scroll bar? If not, I appreciate all the help you have given me. :)
It seems that this is not possible. And it is expected ActiveDayChanging to be fired because even if you click the scroll arrow, the active day still changes.