Its possible load events with onViewChange?

I have a different JSON server and i cant load data with dhtmlxScheduler suggests in manual.

i’m trying to load data with this code, but this code jump a month with day view.

example: 31/jun, press next button, jump to 1/jul, press next button, jump to 1/oct, press next button, jump to 1/set, and so on.

scheduler.attachEvent("onViewChange", function (mode , date){
			currentMonth = date.getMonth();

		if(currentMonth != date.getMonth()){
			var beginDate = date;
			var endDate = date;
			beginDate = $.getInternalDate(beginDate);
			endDate.setMonth(endDate.getMonth() + 1);
			endDate.setDate(endDate.getDate() - 1);
			endDate = $.getInternalDate(endDate);
			refreshCalendar(beginDate, endDate);
			currentMonth = date.getMonth();
		return true;

[code]function refreshCalendar(beginDate, endDate){
if(!$.isEmpty(beginDate) && !$.isEmpty(endDate)){
lastBeginDate = beginDate;
lastEndDate = endDate;

	className	: "scheduler",
	queryName	: "serviceList",
	par1		: "1,2,5,7,9",
	par2		: lastBeginDate,
	par3		: lastEndDate,
	after		: function(result){
		scheduler.parse(result.result.row, "json");


Any idea?


var beginDate = date; var endDate = date;


var beginDate = new Date(date); var endDate = new Date(date);

Your current code corrupts original date object while calculating begin and end dates