Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rod on Aug 15, 2009 02:31
open dhtmlx forum
attached tree into layout

Hi, i have a little problem triying to get 'myTree.getSelectedItemId()', in fact i can't reach 'myTree' object,....so the code is like this...

index.php:
...
var myLayout;
myLayout = new ....... ( a layout with two panels, one for a tree an another for a form )
...
myLayout.cells("a").attachURL("tree.php");
myLayout.cells("b").attachURL("form.php");
...

tree.php:
...
var myLayout = parent.myLayout; <-- i get rid of the layout objet by this way, it works fine!
var myTree = new .... (a tree object)
...
myLayout.cells("a").attachTree("0"); <- i've done this way because i want the scrollbars over the panel

form.php
...
var myLayout = parent.myLayout;
...

so, how i get rid of the tree attached object in here??

i've tryed:

var myTree = myLayout.myTree => undefined
var myTree = myLayout.cells("a").myTree => undefined
var myTree = myLayout.cells("a").document.myTree => document is undefined

i've checked that all variables my* are at the correct scope ( i mean not inside a JS function or whatever), because the code is not 'exactly' this same it is not posible to pass the node id trougth the URL when calling the form.

and finally, just for contribute, this rare implementation ( attaching an URL into a pane and then attahcing a tree to a pane ) is because if you dont do it like this way:

if the tree heigth exceds the panel heigth the scrollbar appears on the panel, BUT if the tree width exceds the panel width the scrollbars appears on the tree.. so it means if the tree exceds both, you should scroll the panel all the way down to see the horizontal scrollbar.

hope i've explained it clear
Answer posted by Alex (support) on Aug 17, 2009 02:17

Hello,

tree is in iframe. So, you should use special approach to get its object:

tree.php: 

//var myTree = new .... (a tree object) 
var myTree = myLayout.cells("a").attachTree("0"); 


form.php:

var myTree = parent.myLayout.cells("a")._frame.contentWindow.myTree;

Answer posted on Aug 17, 2009 02:51
ok, i'll try this, im sure it will work.

i didnt thougth it was into a iFrame 'cause Firefox doesnt shows the "this frame" option in the contextual menu.. i'll try Firebug to see if it shows me the really runtime DOM

by the way.. it (the missing "this frame" option) only happen over panels with attached objects trougth "myPane.cells(...).attach<Class>(...);"
Answer posted by Alex (support) on Aug 17, 2009 08:44

>> i didnt thougth it was into a iFrame 'cause Firefox doesnt shows the "this frame" option in the contextual menu..

please, provide the complete demo that allows to reproduce the issue

Answer posted by Rod on Aug 22, 2009 04:49
the "._frame.contentWindow" approach didn't work

i have take a deep look into my code and it is logic, this is NOT a bug or something (if you want a full -very long- explanation just ask me for it)

in fact, my problem are the scrollbars, there is a way to set trees to dont show any scrollbar and let panels/cells do it for them?
Answer posted by Alex (support) on Aug 24, 2009 00:33

Hello,

>> if you want a full -very long- explanation just ask me for it

we need complete demo (any complete sample) that demonstrates the issue 

>> there is a way to set trees to dont show any scrollbar and let panels/cells do it for them?

Tree shows scrollbars when it's necessary to show all open items in tree. In order to set tree overflow hidden you can redefine the following css class:

<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtree.css">
<style>
 .containerTableStyle { overflow : hidden;}
</style>