defining an event handler when clicking the next button

i want to define an event handler when clicking the next button in month view in order to load new events to the calendar ?
How to do this ?

You can use onAfterMonthChange of calendar:

$$("scheduler").$$("calendar").attachEvent("onAfterMonthChange",function(nextDate,prevDate){ // your code });

thanks a lot ! how about the day view ? is there an afterDayeventChange?

The solution that will work for both Day and Month views:

$$("scheduler").coreData.attachEvent("onChange",function(){ var view = $$("scheduler").$$("buttons").getValue(); if( view == "month" ){ // month view is active } else if( view == "day" ){ // day view is active } })

hi again , this way i will have to handle any click event on any buuton like the days in the month view , i want to handle only click events for the button next and prev in the month and the day views .

Hi, “prev” and “next” - ids of the buttons in “day” view toolbar. So, you may set the following:

$$(“scheduler”).$$(“prev”).attachEvent(“onItemClick”,function(){ … });
$$(“scheduler”).$$(“next”).attachEvent(“onItemClick”,function(){ … });

Hi ,

$$(“scheduler”).$$(“prev”).attachEvent(“onItemClick”,function(){ … });
$$(“scheduler”).$$(“next”).attachEvent(“onItemClick”,function(){ … });

Did you mention above for prev and next labels in case of day-view ?
I put alert in it, but I am unable to get the alert…

So I tried for for using normal function which we mentioned , while creating toolbar and I got it. here is defination [ click: “prevClick” ]

In my apps , I am trying to get values for those prev and next dates in day view…

In case of calendar_view I am getting value from “onAfterMonthChanges” but in case of day_view how can we get those value?

Please need help :frowning: :cry:

Hi,

Did you mention above for prev and next labels in case of day-view ?
I put alert in it, but I am unable to get the alert…

Yes, I did. Could you attach a demo that reproduces the problem ?

In my apps , I am trying to get values for those prev and next dates in day view…

You can use $$(“scheduler”).coreData.getValue() to get selected date. However, if you are apply this approach inside event handler, it will be more correct to use delay:

$$("scheduler").$$("prev").attachEvent("onItemClick", function(){ dhx.delay(function(){ alert($$("scheduler").coreData.getValue()); }); });