Add object to "cols" of layout

Hi all !

I have a layout:

var layout = webix.ui({
        view:"layout", 
        container:"mydiv",
        rows: [
              {
                  cols: [
                       
                  ]
              }
        ]
    })

How do i add a component to “cols” ?

And i have a datatable:

var datatable = webix.ui({
    view: "datatable",
    ......../*config*/......
});

I want add datatable to the layout with a section code like this: layout.add(datatable);

How do i do ?

You need to define id for the related layout

var layout = webix.ui({
        view:"layout", 
        container:"mydiv",
        rows: [
              {   id:"subview",
                  cols: [
 
                  ]
              }
        ]
    })

and later you can use

$$("subview").addView({
    view: "datatable",
    ......../*config*/......
})

Can you help me, @maksim ?

@maksim
Can i do it without define id ?
How do i add components into cols of “subview” ?

You need some way to identify the target view. It can be an id or you can use getChildViews command to locate the necessary view

var sub = layout.getChildViews()[0]; //first child of top level layout
sub.addView({
    view: "datatable",
    ......../*config*/......
})

Thank @maksim