I want to insert a grid and a form in window, but I don’t know how.
If you want to add multiple components in a window, you’ll have to attach a layout to the window, and then attach the components to the layout.
This isn’t the only way to do it, but I do it this way so all the components are able to be referenced from external code with relative consistency:
// These configs are irrelevant to the example
var configForm = {};
var configGrid = {};
var configWindow = {};
var win = new dhx.Window(configWindow);
win.layout = new dhx.Layout(win,{
height: "100%",
rows: [
{id:"form-container",height:200,gravity:false},
{id:"grid-container"}
]
});
win.layout.form = new dhx.Form(win.layout.cell("form-container"),configForm);
win.layout.grid = new dhx.Grid(null,configGrid);
win.layout.cell("grid-container").attach(win.layout.grid);
For some reason, I keep getting an error if I try to create the grid with the container set to the layout cell, even though it works for all the other components I’ve tried. So with the grid I just create the grid will a null container, and then attach it to the layout cell.
I’ve had best results with setting the height of the upper layout cell and setting gravity: false; the lower cell then fills the rest of the available layout space, which in this case is the window height.
In case of attaching a component to a layout cell you should not define a container for that component and leave the NULL
what about the window with a grid and form - this is the right solution. You needto atttach a layout with the cells for each component