How to get the windows ID


#1

It’s possible to return in the window, the window ID?

This is a part of the code that create the Windows:

dhxToolbar7 = tabbar.cells("c9").attachToolbar();
dhxToolbar7.setIconsPath("dhtmlx/dhtmlxMenu/samples/common/imgs/");
dhxToolbar7.addButton("New", 1, "Crea nuovo operato...", "page_white_add.png", "page_white_add.png");
dhxToolbar7.attachEvent("onClick", function(id) {
if(id=="New") {
createWindow('Operato_add.php?CID=<? echo $_GET["CID"]; ?>','Aggiungi operato','500','372','yes');
w1.allowResize();
}
});

Now in the opened page i want too display that this is the window with ID w1, is this possible?


#2

There is a method of getting window’s ID getId():
docs.dhtmlx.com/doku.php?id=dhtm … sngl_getid


#3

I’m using this script:

<script>
dhxWins = new dhtmlXWindows();
var idPrefix = 1;
/*
- url= address
- title: titol of the window
- w: width
- h: height
- r: is resizable?
*/

function createWindow(url, title, w, h, r) {
	var p = 0;
	dhxWins.forEachWindow(function(){p++;});
	if (p>=5) {
		dhtmlx.message({
			title:"Important!", 
			type:"error", 
			text:"Not more than 5 windows are allowed"
		});
		return;
	}
	var id = "userWin "+(idPrefix++);
	var win = dhxWins.createWindow(id, 20, 50, w, h);
	win.setText(title);
	var winId= dhxWins.window(id)
	dhxWins.window(id).center();
	win.button("park").hide();
	win.button("minmax1").hide();
	win.attachURL(url);
	dhxWins.window(id).keepInViewport(true);
    if(r==0){win.denyResize();}
};
</script> 

Now I have 2 questions:

  • on the created window how can I get the id of the page, the getId() function don’t works :angry:
  • if the created window (window 2) is created on the parent (parent.createWindow(…) from another window (window 1) is there a way to obtain in window 2 the id of the first window, if the window would be created on the window 1 this window would be the parent, but in this case it’s not the parent but like a sister :stuck_out_tongue:

#4

Please, try to use:

dhxWins.forEachWindow(function(window){
    var id = window.getId();
});

It returns the id of the window well for me.