Onclick dhtmlxMenu "Can't execute code from a freed script"

Hi team,

I’ve got a new problem…

I use dtmlxMenu, attached to dxhLayout where a scheduler is attached to.

I use the menu to filter my schedduler (scheduler.updateCollection).

Here is my code :


	<!-- Scheduler -->
	<link rel="stylesheet" href="/tools/dhtmlxScheduler/codebase/dhtmlxscheduler_flat.css" type="text/css" media="screen" title="no title"  charset="utf-8">
	<script src="/tools/dhtmlxScheduler/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
	<script src="/tools/dhtmlxScheduler/codebase/locale/locale_fr.js" type="text/javascript" charset="utf-8"></script>
	<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_quick_info.js" type="text/javascript" charset="utf-8"></script>
	<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_units.js" type="text/javascript" charset="utf-8"></script>
	<!--<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_cookie.js" type="text/javascript" charset="utf-8"></script>-->
	<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script>
	<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_collision.js" type="text/javascript" charset="utf-8"></script>
	<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_limit.js" type="text/javascript" charset="utf-8"></script>
	<!--<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_tooltip.js" type="text/javascript" charset="utf-8"></script>-->
	<!--<script src="/tools/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_grid_view.js" type="text/javascript" charset="utf-8"></script>-->

	<!-- Message -->
	<link rel="stylesheet" href="/tools/dhtmlxSuite/sources/dhtmlxMessage/codebase/skins/dhtmlxmessage_dhx_terrace.css" type="text/css" media="screen" title="no title"  charset="utf-8">
	<script src="/tools/dhtmlxSuite/sources/dhtmlxMessage/codebase/dhtmlxmessage.js" type="text/javascript" charset="utf-8"></script>
	<!-- Menu -->
	<link rel="stylesheet" href="/tools/dhtmlxSuite/sources/dhtmlxMenu/codebase/skins/dhtmlxmenu_dhx_web.css" type="text/css" media="screen" title="no title"  charset="utf-8">
	<script src="/tools/dhtmlxSuite/sources/dhtmlxMenu/codebase/dhtmlxmenu.js" type="text/javascript" charset="utf-8"></script>

"some code"....

		scheduler.init('scheduler_here',new Date(),"court");
		//scheduler.load("./data/events.xml");

		topMenu.clearAll();
		topMenu.addNewSibling(null, "all", "Tous les plannings", false);
		topMenu.addNewSibling("all",          "id_tennis",    "Tennis",    false);
		topMenu.addNewSibling("id_tennis",    "id_badminton", "Badminton", false);
		topMenu.addNewSibling("id_badminton", "id_squash",    "Squash",    false);

		topMenu.attachEvent("onClick", function(id, zoneId, cas){
			if(id=='all'){
				scheduler.updateCollection("court", lst_courts_all);
			} else {
				lst = "lst_courts_";
				lst = lst+id.substring(3,id.length);
				lst = eval(lst);
				setTimeout(function(){scheduler.updateCollection("court", lst)},100);
			}
			return true;
		});

The first time I come on this page updateCollection is working but if I leave and come again, it doesn’t work and I have the error:

Can you help me please?

Loïc

I’d just solved my problem by using detachMenu() instead of using clearAll() and rebuild a complete menu.

Good