Rendering of the xgrid using dhtml object grid =

I use javascript to add the nodes to the main page and the grid renders but there is an overlap of white space, both horizontally (small space) and vertically, (large area). Any idea?

Grid detects its size from HTML container, if there is no clearly specified width or height settings, grid takes actual size of container on moment of rendering
Please be sure that on moment of grid rendering its parent container already has correct size.

If size will be set later, add next line after final size set
it will force grid update to new sizes.