Problem with attaching an object

I’m using a “3T” layout in a window which has a grid attached to the first and second cell.
In the third one, I want to attach an object declared in my html part.

But nothing appears in the cell … somebody has an idea of the problem ?

hore is the code :

<div id="myDiv">hello</div>
<script>
	var dhxLayout = parent.dhxWins.window("view_ticket").attachLayout("3T");

	var grid1 = dhxLayout.cells("a").attachGrid(); // OK
	[...]
	grid1.init();

	var grid2 = dhxLayout.cells("b").attachGrid(); // OK
	[...]
	grid2.init();

	dhxLayout.cells("c").attachObject("myDiv"); // KO
</script>

Hello,

strange, you should see “hello” in “c” cell.
please attach your demo?

Hello,

I’m currently working with Guildux on the same project.
The problem doesn’t appear if the code is directly loaded in the browser.

But we encountered it if we are loading the code in a dhtmlxWindow with the attachURL method.

Regards,

Hi,

it seems the problem is the div element isn’t loaded in the DOM when the attachObject method is called (I tried to get the DOM object with a document.getElementById … and it fails).

I also thought to embed the javascript code in a function called when the content is fully loaded in the window (see the code below), but the callback is never called (I haven’t any widget in the window … just the “div’s content”) … any idea ?

<div id="myDiv">hello</div>
<script>
   parent.dhxWins.window("view_ticket").attachEvent("OnContentLoaded", function() {

      var dhxLayout = parent.dhxWins.window("view_ticket").attachLayout("3T");

      var grid1 = dhxLayout.cells("a").attachGrid(); 
      [...]
      grid1.init();

      var grid2 = dhxLayout.cells("b").attachGrid(); 
      [...]
      grid2.init();

      dhxLayout.cells("c").attachObject("myDiv"); 
   });
</script>

Hi,

could you please create some sample that allows to reproduce the problem locally ?

You can find a sample juste here : http://ge.tt/86yH486

Thx

attachURL(url,true) loads content using Ajax and places it as innerHTML .

So,

hello
became the content of the window. When you call var dhxLayout = dhxWins.window(“test”).attachLayout(“3T”);, the layout replaces this div (div is removed).

Therefore, dhxLayout.cells(“c”).attachObject(divId) causes error.

You need to attach an iframe:
win.attachURL(‘include.html’);

or attach html string to the “c” cell:
dhxLayout.cells(“c”).attachHTMLString(‘

hello
’);

Thx for the response.

However, if I attach an iFrame, I can’t catch checkbox’s events in a grid attached to a cell.

I confirm this behaviour, I have the same problem with a form dynamically loaded in an iFrame …

the “OnButtonClick” event is never catched in an iFrame, but in Ajax, it works very well.

Please see the last part of my previous answer, it relates ajax loading