Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Johannes Persson on Dec 14, 2009 06:04
open dhtmlx forum
dhtmlxConnected tree in layout

Hi!
I´m new att dhtmlx.

I´m trying to connect to a mysql and display the result in a dhtmlxtree.
I´ve tied the samples files and everything works fin.
But i don´t get it to work when i attached a tree to a cell in my layout.

Se code (everything in teh second div works fine)

<div id="parentId" style="position: relative; top: 0px; left: 0px; width: 600; height: 300; aborder: #B5CDE4 1px solid;"></div>

<script type="text/javascript" charset="utf-8">

var dhxLayout,
dhxMenu;dhxTree;
function doOnLoad() {
dhxLayout = new dhtmlXLayoutObject("parentId", "2U");
// access through cells;
dhxLayout.cells("a").setText("Meny");
dhxLayout.cells("a").setWidth(200);
    dhxLayout.cells("a").fixSize(true);
    
    dhxMenu = dhxLayout.cells("a").attachMenu();
dhxMenu.setIconsPath("./administration/css/dhtmlxMenu/samples/common/imgs/");
dhxMenu.loadXML("./administration/css/dhtmlxMenu/samples/common/dhxmenu.xml?etc=" + new Date().getTime());

dhxTree = dhxLayout.cells("a").attachTree();
dhxTree.setImagePath("./administration/css/dhtmlxTree/codebase/imgs/csh_vista/");
dhxTree.loadXML("./administration/css/dhtmlxTree/samples/common/tree.xml?etc=" + new Date().getTime());

dhxLayout.cells("b").hideHeader();
    dhxTree = dhxLayout.cells("b").attachTree();
    dhxTree.setImagePath("./administration/css/dhtmlxTree/codebase/imgs/csh_vista/");
dhxtree.loadXML("./administration/css/dhtmlxConnector_php/samples/tree/02_dynamic_loading_connector.php" + new Date().getTime());
// access through items;
dhxLayout.items[1].setText("Content");

// or;
// var layout1 = dhxLayout.cells("c").attachLayout("2U");
}

</script>


<div id="treeboxbox_tree" style="width:300; height:218;background-color:#f5f5f5;border :1px solid Silver; "></div>

<script type="text/javascript" charset="utf-8">
    tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);
    tree.setImagePath("../common/imgs/");
    //tree.enableSmartXMLParsing(true);
    tree.setXMLAutoLoading("./administration/css/dhtmlxConnector_php/samples/tree/02_dynamic_loading_connector.php")
tree.loadXML("./administration/css/dhtmlxConnector_php/samples/tree/02_dynamic_loading_connector.php");
</script>
Answer posted by Alex (support) on Dec 14, 2009 06:34

Hello,

there is an incorrect case in the tree object call. Try to use:

dhxTree.loadXML("./administration/css/dhtmlxConnector_php/samples/tree/02_dynamic_loading_connector.php" + new Date().getTime());

instead of 

dhxtree.loadXML("./administration/css/dhtmlxConnector_php/samples/tree/02_dynamic_loading_connector.php" + new Date().getTime());

Answer posted by Johannes Persson on Dec 14, 2009 10:09
Thanx it solved the problem, but i have to remove    + new Date().getTime());

Do you know you?
Answer posted by Alex (support) on Dec 15, 2009 01:54

Yes, there is also ? missed:

dhxTree.loadXML("./administration/css/dhtmlxConnector_php/samples/tree/02_dynamic_loading_connector.php?" + new Date().getTime());

Answer posted by Johannes Persson on Dec 15, 2009 10:01
You´re right!

Works great now!

Do you also know how to use headers in layout but disable collapse function in some cells?


Answer posted by Alex (support) on Dec 16, 2009 02:11

>> Do you also know how to use headers in layout but disable collapse function in some cells?

You can try to use onCollapse event handler. For example if the "a" cell should be always visible, the following method can be applied:

dhxLayout.attachEvent("onCollapse", function(itemId){

    if(itemId=="a") dhxLayout.cells("a").expand();
});

Answer posted by Johannes Persson on Dec 17, 2009 02:15
Thnax but is there also a possible to disable resize cells. So the user can´t drag cells and change width?
Answer posted by Alex (support) on Dec 17, 2009 02:24

Try to use fixSize method: dhxLayout.cells("a").fixSize(true,true);

http://www.dhtmlx.com/docs/products/dhtmlxLayout/samples/02_conf/13_fixsize.html