Layout and views

Folks,

I am trying to understand how the views work, and having a little difficulty. I have a single cell layout with a toolbar at the top and a div attached to the layout to hold some content. This works fine. However if I do not attach the grid directly to the layout but rather to a view, the toolbar gets overwritten. Here is a sample of the code:

layout = new dhtmlXLayoutObject(document.body, “1C”);
var div = document.getElementById(‘content’);
div.innerHTML = “Hello World!”;
layout.cells(‘a’).view(‘foo’).attachObject(div);
layout.cells(‘a’).view(‘foo’).attachObject(div);

Any help would be greatly appreciated.

Thanks,

Daryl

Hi
Here is a sample cod for you - try similar approach.

[code]

Views html, body { width: 100%; height: 100%; margin: 0px; overflow: hidden; background-color:white; } function doOnLoad() { dhxLayout = new dhtmlXLayoutObject("cont", "1C");
            view1 = dhxLayout.cells("a").attachLayout("1C");
            view1.cells("a").attachToolbar();
            view1.cells("a").attachObject(document.getElementById('myDiv'));

            view2 = dhxLayout.cells("a").view("v2").attachLayout('1C');
            mygrid = view2.cells("a").attachGrid();
            mygrid.setImagePath("../dhtmlxGrid/codebase/imgs/");
            mygrid.loadXML("../___xml/grid.xml");
        }
        function f_v1(){
            dhxLayout.cells("a").view("def").setActive();
        }
        function f_v2(){
            dhxLayout.cells("a").view("v2").setActive();
        }
    </script>
</head>
<body onload="doOnLoad();">
<div id="cont" style="width: 600px; height: 400px"></div>
<div id="myDiv" style="background: #FFCC00; width: 100%; height: 100%">Content div</div>
<div id="mfoot" style="width: 100%; height: 100px">
    <input type="button" value="view1" onclick="f_v1()">
    <input type="button" value="view2" onclick="f_v2()">
</div>
</body>
[/code]