How to resize a datatable view embedded in a form view ?

Hello,

I use a form view with a particular width.

It contains several elements of whom a datatable view.

This is the source :

id:"f1",
view:"form",
width:780,
elements:[
       ...
       {
               view:"datatable",
               width: 400,
               id:"d1",
               columns:[  ....
                              ],
               autoheight:true,
               autowidth:true,
               ....
        }          
]

Even if I defined a total width lower than 780 for my datatable, my datatable spreads out on the value 780 !

How let us can be made so that my datatable can have its “width” own independent from that of the parent containeur (form view) ?

Thanks you

FM

You need to add fillter next to the datatable

Instead of

elements:[
   line1,
   table,
   line2,
]

you can use

elements:[
   line1,
   { cols: [ table, {} ]}
   line2,
]

It will add an empty view which will take the unused space

Thanks you maksim, it’s ok.

Other question :

if we don’t use this empty view, is it possible to align (ex: center) my datatable with regard to my parent container (form view) ?

The layout system need to fill empty space with something. So you need to use fillers or view will resize self to fill gaps.

For centering view, just add two fillers

{ cols: [ {}, table, {} ]}

ok it’s perfect, thanks you