Is it possible tu use Scheduler with Window and Toolbar?

Hello,

I’m getting a strange errors when I’m trying to use them together.

		scheduler.attachEvent("onContextMenu", function (id, ev){
			if(id == null) return false;
			rmenu(id);
       		return false;
		});
	function rmenu(id) {
		event = scheduler.getEvent(id);
      	        var opis = "...";
		var win = dhxWins.createWindow("w_kal", 200, 10, 400, 400);
		win.setText("Menu RQ");
		win.attachHTMLString(opis);

		var toolbar = dhxWins.window("w_kal").attachToolbar();
		var i = 0;
		if(upr("E",id)) toolbar.addButton("e", i++, "Edycja");
...
	    	toolbar.attachEvent("onClick", function(a) {
	        	if(a == "e") edytor(id);
...
	        	toolbar.unload();
	        	toolbar = null;
	        	dhxWins.window("w_kal").close();
	    });
	}

There is a problem with closing the “w_kal” window with “X” button: I receive a js error this.detachAllEvents() is not a function in dhtmlx.js line 2393.
I was trying many solutions and discovered that when I swap .js imports, then the closing would work, but I would get another error.
Instead of that:

       <script src="/dhtmlx/dhtmlx.js"></script>
       <script src="/dhtmlx/dhtmlxScheduler/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>

I wrote that:

       <script src="/dhtmlx/dhtmlxScheduler/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
       <script src="/dhtmlx/dhtmlx.js"></script>

Then, closing works without error. But I can’t add events on Scheduler - I click “save” and the Connector does nothing. I was looking at the logs and discovered that in this case there is no “editing=true” parameter given to the Connector.
I’m using a Professional 2.6 version of Suite, java Connector and trying 2.3 free Scheduler. Maybe should I import some .js files?

We will check the possible reasons, as fast solution, you can add the content of included js file to the end of dhtlmxscheduler.js
hotfix.zip (673 Bytes)

Thanks, now is possible to close the window, but i’m still getting strange errors.
When I add new event, I want to reload events from the database

		scheduler.clearAll();
		scheduler.load("sch.do?sesja=xxx");

but on one of servers I get randomly an error “this.getEvent(b) is undefined” in dhtmlxscheduler.js line 39. It happens both in month and week view.
What does this error means? Is it caused by inproperly working connector? I’m using the Java version and it doesn’t throw any exceptions.

Error may be caused by racing conditions.
Try to replace the direct call of above commands with timed one

window.setTimeout(function(){ scheduler.clearAll(); scheduler.load("sch.do?sesja=xxx"); },1);