grid not resizing in a div

Folks,

I have a div holding a grid. The div has width and height set to 100%; when the browser is resized the grid does not resize with the rest of the browser. When I examined the DOM I found that the div width and height had been reset to the browsers previous width and height, apparently by dhtmlx. The code follows:

var mygrid = new dhtmlXGridObject(‘gridbox’);

I have tried using:

grid.attachEvent(“onResize”, function(cInd, cWidth, obj){
obj.setSizes();
});

as well as:

dhtmlxEvent(window, ‘resize’, function(e) {
mygrid.setSizes();
});

but nothing has worked. I know I can get the grid to resize by attaching it to a full page layout, but I need to get it to resize inside the div.

Any help would be greatly appreciated.

Thanks,

Daryl

Oops, there is a typo in the original message; the div’s width is “100%” and not “105”

Thanks,

Daryl

Please, try to set the withs of your columns in percentages:
docs.dhtmlx.com/doku.php?id=dhtm … nitwidthsp

or use “*” in one of the columns width.

Hi Sematik,

Thanks for your reply. Yes I am already using the setInitWidthsP() function as follows:

    mygrid.setInitWidthsP("*,*,*,*,*,*,*,*,*,*,*,*,*");

but the grid still does not resize. What is the correct way to use the setSizes() function, is it inside of a grid.attachEvent(“onResize”) or a dhtmlxEvent() function, and should it be before or after the init?

Thanks for your help.

Daryl

Here you can find a working example of the grid changing the column widths accordingly to the container sizes:
dhtmlx.com/docs/products/dht … esize.html

If issue still occurs for you - please, provide us with any kind of sample of your code or a complete demo where the issue can be reproduced.