Grid expands then shrinks on page load

Hi there,



we have a small problem with the dhtmlXGrid Pro version.

We use our own template system to insert the grid into pages and we set the grids properties from PHP by insering values into placeholders in the Javascript code of the grid. We use paging by default and populate the grid with xml data using loadxml().



Everything works fine except on page reload, the grid is first diplayed with a column width of 73 pixels in the header line and 76 pixels in the data lines for all columns. And there’s a large gap between the header line and the data line of 161 pixels.

This is only visible for a fraction of a second but it causes a flicker that we want to avoid. After that the grid is displayed as desired without the gap and correct column widths.



We’re not quite sure if this behavior depends on our method to build the Grid by code, but maybe there’s a method of switching off the page display during load and show it when it’s populated with data. We could’t figure out how to do this.



Thanks in advance,



Joachim Kathmann, i22.de GmbH





Such error can occur in two cases

a) grid was initialized in hidden state and switched to visible state later
b) grid was initialized in moment, when its parent container was not correctly closed yet ( the problem most common for complex table layouts in IE )

In both mentioned cases just add grid.setSizes(); command after data loading or after switching container to visible state
Something similar to next

grid = new …

grid.loadXML(url,function(){
    grid.setSizes();
});


In case if problem caused by not closed table layout - starting grid initializaiton only on page loading will help as well.

Hi Stanislav,

It works! Thank you for your ultra-fast support. Simply great.