updateCollection invoke viewChange????

Hi does anyone know if the following line invokes the onViewChange() function???

scheduler.updateCollection("vehicles", result);

The reason I ask is that the following code causes an infinite loop where all I’m looking to do is update sections when the view is changed.

[code]scheduler.attachEvent(“onBeforeViewChange”, function(old_mode,old_date,mode,date){
if (typeof old_date === “undefined”) {
return true;
}
else
{
day = zeroPad(date.getDate(), 2);
month = zeroPad(date.getMonth() + 1, 2);
year = date.getFullYear();

	new_date = day + "-" + month + "-" + year;
	
get_all_diary_vehicles(new_date, function(result)
{
	scheduler.updateCollection("vehicles", result);
});

return true;
}

});
[/code]

Hi,
yes, update collection invokes ‘scheduler.setCurrentView’, which triggers onViewChange and onBeforeViewChange events.
In order to prevent infinite loop, you may check arguments on onBeforeViewChange event handler - if the mode and date have stayed the same as previous, it means the view has been refreshed(no date or mode change), and sections shouldn’t be updated

Perfect. such a simple solution and works great. Thanks again for your help.