Cookie + dhtmlCalendar

Hello !

Good to be back… Finally i updated my stuff to the 2.1 Version and fixed every issues it brings among. At least one thing doesn’t work any more: The Calendar integration.

I added the Calendar to the scheduler and when i click a day, scheduler-view changed.
When i use the extension with the remembering view cookie (nice stuff btw.!) it doesn’t work any more… Tried to check out the dhtmlxscheduler_cookie.js, but it’s not in plain js, so i couldn’t get the point why the function

[code] window.onload = function() {
mCal = new dhtmlxCalendarObject(‘dhtmlxCalendar’, false, {
isWinHeader: true
});

	mCal.attachEvent("onClick", mSelectDate);
	mCal.setSkin("vista2");
	mCal.loadUserLanguage("de");
	mCal.draw();
	init();
}

function mSelectDate(date) {
	[b]scheduler.setCurrentView(date, "day");[/b]
	return true;
}[/code]

is not working anymore :confused:

Is the method blocked by the cookie piece of code?

Greetingd from .dE,
2Fast

Hello,

cookie extension sets cookie when the scheduler view changed. So, it can’t cause problems with dhtmlxCalendar. I’ve attached the non-compressed version.
ext_cookie.zip (600 Bytes)

Thank you!

I will check it after work.
But without testing i am quite sure it is the subfunction

scheduler.attachEvent("onBeforeViewChange",function(om,od,m,d){ if (first){ first = false; var data=getCookie("scheduler_settings"); if (data){ data = data.split("@"); data[0] = this.templates.xml_date(data[0]); this.setCurrentView(data[0],data[1]); return false; } } var text = this.templates.xml_format(d||od)+"@"+(m||om); setCookie("scheduler_settings","expires=Sun, 31 Jan 9999 22:00:00 GMT",text); return true; });

I will give feedback for everyone who also wants to concut the Calendar with the Schedular (isn’t it a good task? :wink: )

I just tried a workaround by changing my function with a global dummy:

[code]var dummy = false;
function mSelectDate(date) {

	dummy = true;
	scheduler.setCurrentView(date, "day");
	dummy = false;
	return true;

}[/code]
Furthermore edit the onBeforeViewChange-event in the cookie.js

scheduler.attachEvent("onBeforeViewChange",function(om,od,m,d){ if (dummy == false) { if (first){ first = false; var data=getCookie("scheduler_settings"); if (data){ data = data.split("@"); data[0] = this.templates.xml_date(data[0]); this.setCurrentView(data[0],data[1]); return false; } } var text = this.templates.xml_format(d||od)+"@"+(m||om); setCookie("scheduler_settings","expires=Sun, 31 Jan 9999 22:00:00 GMT",text); } return true; });

But when i am using this, there is an issue:
Cookie i still written and my view is saved when i reload. But when i change the view via the calendar (works) i can not change into week or month view (but i CAN change with the little arrow images on top day left or day right and after one of this clicks i can click on week or month again and it works)…

Was anybody able to understand? :slight_smile:
Would like to get this problem :-/

By the way: How am i able to manually change the currentView with a string? I tried scheduler.setCurrentView(‘18-02-2010’, “day”); but it is wrong…

I’ve attached the ready sample - possibly it’ll help.

How am i able to manually change the currentView with a string?

setCurrentView method requires Date object.
scheduler_calendar.zip (70.7 KB)