Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Sep 17, 2008 02:36
open dhtmlx forum
DHX Calendar : How to reset the calendar.

Hi there,
I want to reset the month which is shown in the calendar.

Take this situation :

1. When I click on calendar, it shows the current month. When I iterate thru some of the previous months and close the
calendar then I close the calendar.
2. When I again open the calendar, it should show the current month instead of previously shown month.

How to achieve this ?
Answer posted by Support on Sep 19, 2008 01:27
You can try to use the following approach:

1) to get the currect date:

var cur_date;

mCal = new dhtmlxCalendarObject(...);
....
mCal.draw();
cur_date = mCal.cutTime(new Date());

2) and set this date each time when the calendar is shown:

function show() {

mCal.show();
mCal.setDate(cur_date);

}

Answer posted by Tejas Shah on Oct 06, 2008 04:50
Hi there,
            Its not working.

            Take this situation:
            1. Click on calendar, choose a date.
            2. Again click on calendar, go to some 3-4 months back, DON'T choose a date and close the calendar(I have given a close button on calendar)
            3. It shows 3-4 months back calendar, not the month of which I chose the date.

            Why ?

Answer posted by Support on Oct 06, 2008 06:36
>>When I again open the calendar, it should show the current month instead of previously shown month.

mCal.setDate(new Date()); //this command will alway set the current date 
mCal.show();