The solution for layout.cells(id)._frame issue in 2.6

If you’ve updated layout (windows, accordion or tabbar) to 2.6 version, there may be a problem with _frame property that could be used with the 2.5 version.

The attached file is the modified dhtmlxcontainer.js from v.2.6. Here we’ve added getFrame() method that should be used instead of _frame property:

var ifr = layout.cells(cell_id).getFrame();

instead of

var ifr = layout.cells(cell_id)._frame;
dhtmlxcontainer.zip (7.4 KB)

Hello,

How can I call a function in the iframe, I tried to do it like this:

 var ifr = layout.cells(cell_id).getFrame().myFunc(); 

But this isn’t working.

Regards,
Michiel

Hi,

First you need to read this:
docs.dhtmlx.com/doku.php?id=dhtm … me_content

Then you need to use Alexandra’s code for getting iframe link:
var ifr = layout.cells(cell_id).getFrame();

And then you may call function:
ifr.contentWindow.myFunc();

try
            {
                
                ifr = dhxWins.window("w_testwindow").getFrame();
                iswindowopen = ifr.contentWindow.checkme();
                

            }
            catch(err){
                //Window is not open
                iswindowopen = false;
            }

If window “w_testwindow” doesn’t exist, getFrame() crashes IE8 with message in

dhtmlx.js

Line: 1770
Error: Invalid argument.

function(win) {win.style.width = (String(win.w).search("%")==-1?win.w+"px":win.w)

Sorry, can’t delete my previous post.

Please ignore it for now, it seems that something else is the problem with IE8.

Can you please post sample code for the above ie for calling function inside a attached html.
I tired but could not succeed. I have v2.5 also downloaded attached file dhtmlxcontainer and tried.

Please help me with the sample code.
thanks

In my code I check if a window is open and then try to execute a function from it. You can see the example in the posted code.

Are you talking about the same thing or “attachURL” in some layout?

I have a layout with two division (copied it from demo). A tree is attached on the left. I want to call a function on click of a node on the tree to execute a javascript in page2.htm that is attached to layout on right.

This is the senario:

page1.htm

function doOnLoad(){
myLayout = new dhtmlXLayoutObject(document.body, “2U”, “dhx_blue”);
myTree = myLayout.cells(“a”).attachTree(“0”);

myTree.setOnClickHandler(onNodeSelect);
}

function onNodeSelect(nodeId){

var lv_url="./path/page2.htm";
myLayout.cells(“b”).attachURL(lv_url);
var ifr;
ifr = dhxLayout.cells(id).getFrame();
ifr.contentWindow.justcall();

}


page2.htm

function justcall(){
alert(“successes!”); // does not work
}

Please let me know how can I make it work?

Hello,

probably your page2 not loaded when you call “justcall”
try to do the same from “onContentLoaded” event or check using timeout.
also your id seems not specified here: ifr = dhxLayout.cells(id).getFrame();

dhxLayout.attachEvent(“onContentLoaded”, function(id){
var ifr;
ifr = dhxLayout.cells(id).getFrame();
ifr.contentWindow.justcall();
});
then do attachURL.

something like.

Hello In Jacob the guy who apply for the demo suite.

In the process of demo , there are some problems. those are the things !

If you have any solutions, please give us some.

The symtons are as follows(plz see the attached images that may describe the problems).

  1. For IE (except for IE6), everything works well,

  2. but for FF and Crome, The upper screenshot is works well but
    when I close the first browser, and then in case I re-open that
    the alert says like the latter one on the attached image. after the alert, the brower shows nothing(just shows the white screen))

========================================================================

We’re gonna buy your Entire Pakage in 3 weeks. after the contract (it’s upcoming).

and I attached screenshot under processing.

=========================================================================




The symtons are as follows(plz see the attached images that may describe the problems).

Could you provide the sample (complete demo) that would make the issue clearer and allow to recreate the problem ?

Hello,

I have the same problem and can’t get it works. I have read docs.dhtmlx.com/doku.php?id=dhtm … me_content and follow as docs says.

This is index.html

function doMenuClick(id)
if(id =="logout"){
mainFrame.cells("b").attachURL("/logoff.html");
ifr = mainFrame.cells("b").getFrame();					
ifr.contentWindow.initLogout();
}

logoff.html

[code]


var myForm, formData;

	function initLogout() {
		formData = [{
			type: "label",
			list: [{
					type: "button",
					value: "Ok"
					}, {
					type: "newcolumn"
					}, {
						type: "button",
						value: "Cancel"
					}]
			}];
		myForm = new dhtmlXForm("myForm", formData);
		
		myForm.attachEvent("onButtonClick", doLogout);				
	}

	function doLogout(id){
		alert('logout!');
	}
	</script>

</head>
<body>
	<div id="myForm" style="height:200px;"></div>
</body>
[/code]

Error msg:
TypeError: ifr.contentWindow.initLogout is not a function
ifr.contentWindow.initLogout();

any help would be appreciated…