Grid resize on window resize

Is there a way to size the grid to fill the viewport on browser resize?
On load, the grid fills the screen, but if the user resizes the screen, the grid does not adjust its size.
I tried grid.paint(), but that does not seem to do anything.
I am using dhtmlxSuite v.8.3.6 Professional.

Thanks,
Scott

1 Like

The easiest solution is to place your grid into the layout cell:
https://snippet.dhtmlx.com/hid64zup
In this case it will adjust automatically according to the size of the layout cell.

Otherwise you can adjust the grid sizes manually on the window resize using the following code:

grid.config.height = document.querySelector("#grid").offsetHeight;
grid.config.$height = document.querySelector("#grid").offsetHeight;
grid.config.width = document.querySelector("#grid").offsetWidth;
grid.config.$width = document.querySelector("#grid").offsetWidth;

Like:
https://snippet.dhtmlx.com/pyfdqa3i

Thank you!!! That is what I needed.

Hello.

According to your request we extended this functionality in the latest dhx.Suite update (v8.4.0).
Now the grid successfully updates its sizes according to the parent container automatically, so there is no more needs to resize it manually anymore.
You can check it in the following snippets:
DHTMLX - Grid. Initialization with config.data - simply resizing the browser window
DHTMLX Snippet Tool - changing the container sizes using the radiobox controls.

Please, download the latest available dhx.Suite build from your client’s area to get this dunctionality.
Thank you for your report.
Best regards.