Attach a layout to a tabbar

I wan’t to develop layout in other files and after attach layout to a tabbar, but in docs there a just:

// pattern only
var myLayout = myTabbar.tabs(id).attachLayout("4H");
// api-init config
var myLayout = myTabbar.tabs(id).attachLayout({
    pattern: "4H",
    cells: [
        {id: "a", text: "Navigation", width: 100, header: false},
        {id: "b", text: "Advertisement", height: 100},
        {id: "c", text: "Main Page"},
        {id: "d", text: "Links", collapse: true}

So we have to create a new layout when we wan’t to attch one ?
Can we attach a existing layout ?

Thank you :slight_smile:

Yes, but it is necessary in the beginning to create the layout, then create a tabbar, in tabbare create tabs, they put you layout.

Example: = ‘dhx_web’;
var main_layout = new dhtmlXLayoutObject(document.body, ‘1C’);

var a = main_layout.cells('a');
var tabbar_1 = a.attachTabbar();
var tab_2 = tabbar_1.cells('tab_2');
var layout_1 = tab_2.attachLayout('3E');

Thank you for your answer, but in your example I don’t see where you attach an existing layout :slight_smile:
because you create a tabbar in a cell of a layout, and you put a new layout in the tabBar, me I wan’t to do something like :

var layout_1 = tab_2.attachLayout(layoutInAnOtherFile);

and not :

var layout_1 = tab_2.attachLayout('3E');

because here you create a new layout no ?

thank you :slight_smile:

explain in more detail that you want? what shall be result after execution of a code and how shall look?

I found what I wan’t !
we cannot do what I said because we have to use attachURL !

thank you but I didin’t think about attachURL sorry :slight_smile:


The api of components do not allow to attach the already existing layout to the cell of other component.
You need to use .attachSome api if you want to create a subcomponent inside of the parent one.