Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by JDM on Feb 05, 2009 06:15
open dhtmlx forum
dhtmlxLayout cell content

Hi,

How can i change dhtmlxLayout cell content with <DIV> content?

example:

<div id="menu">
<a id="teste1" href="javascript:void(0)" onclick="testenew1();">Teste1</a>
<a id="teste2" href="javascript:void(0)" onclick="testenew2();">Teste2</a>
</div>
<div id="objId">
Volume Name
<Input type="text" name="vol" id="vol">
<input type="button" name="execbtn" value="click" onclick="sendGet()">
Volume Size
<Input type="text" name="vs" id="vs">
</div>
<div id="objId2">
Outro Quadro
<Input type="text" name="vol2" id="vol2">
<input type="button" name="execbtn" value="click" onclick="sendGet()">
Outro Volume
<Input type="text" name="vs1" id="vs1">
</div>

<script>
var dhxLayout = new dhtmlXLayoutObject(document.body, "3L");
dhxLayout.cells("a").setText("Menu");
dhxLayout.cells("a").setWidth(200);
dhxLayout.setEffect("resize", false);
dhxLayout.cells("a").fixSize(true, true);
dhxLayout.cells("a").attachObject("menu");
function testenew1(xpto){
        dhxLayout.cells("b").layout = null;
        dhxLayout.cells("b").attachObject("objId");
    }
    function testenew2(xpto){
        dhxLayout.cells("b").layout = null;
        dhxLayout.cells("b").attachObject("objId2");
    }
</script>
</body>
</html>

With this code, the first time i click on the links on cell "a" it works Ok, the contents on cell "b" changes,
but when i click again on same links i have a javascript error like this one:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.appendChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://127.0.0.1/newjs/dhtmlxwindows.js :: anonymous :: line 86" data: no]

Regards

JDM
Answer posted by Support on Feb 05, 2009 07:55
Hello

Here is an script behaviour explanation:

command

result

page init

div id=“objA” attached to body

div id=“objB” attached to body

layout.cells(“a”).attachObject(“objA”)

div id=“objA” attached to layout.cells(“a”)

div id=“objB” attached to body

layout.cells(“a”).attachObject(“objB”)

div id=“objA” automatically destroyed by layout

div id=“objB” attached to layout.cells(“a”)

layout.cells(“a”).attachObject(“objA”)

div id=“objB” automatically destroyed by layout

div id=“objA” not exists <- error