Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by dray07 on Jul 17, 2009 12:51
open dhtmlx forum
Attaching to existing Layout

I have a page that is calling onInit() in a separate .js file. onInit() creates a Layout that contains a Tabbar. The first tab of that tabbar makes an ajax call to load a tree. When an element of the tree is selected I need to take action on one of the original Layout object's cells.

However, I cannot create a var that properly attaches to the original layout object. If I use the "new dhtmlXLayoutObject" it just creates a second Layout, I want to attach to the original one. Here are the two methods:

function onInit()
{
var dhxLayout = new dhtmlXLayoutObject("dhParentID", "3L");
var dhxTabbar = dhxLayout.cells("a").attachTabbar();
dhxTabbar.addTab("a1","Results","100px");
dhxTabbar.addTab("a2","Search","100px");
dhxTabbar.setHrefMode("ajax");
dhxTabbar.setContentHref("a1","ResultsFormer.aspx?mode=xload");
dhxTabbar.setTabActive("a1",true);
}

function onResultTreeNodeSelect(nodeId)
{
var dhxLayout = new dhtmlXLayoutObject("dhParentID");

dhxLayout.cells("b").attachURL("UserLoad.aspx?BaseNode=" + nodeId);
}
Answer posted by Alex (support) on Jul 20, 2009 01:24

Possibly the following..

function onInit() 

var dhxLayout = new dhtmlXLayoutObject("dhParentID", "3L"); 
var dhxTabbar = dhxLayout.cells("a").attachTabbar(); 
dhxTabbar.addTab("a1","Results","100px"); 
dhxTabbar.addTab("a2","Search","100px"); 
dhxTabbar.setHrefMode("ajax"); 
dhxTabbar.setContentHref("a1","ResultsFormer.aspx?mode=xload"); 
dhxTabbar.setTabActive("a1",true);

return dhxLayout ;
}

var layout = onInit();

layout.cells("b").attachURL("UserLoad.aspx?BaseNode=" + nodeId);