Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by sbritton on Aug 11, 2008 21:09
open dhtmlx forum
enableAutoHeight doesn't work when adding rows or using group by

The myGrid.enableAutoHeight(true) work fine when loading the data originally, but as soon as I add new rows (refresh from XML) or add a grouping, the table gets longer and a scrollbar appears. How can I keep this from happening?
Answer posted by Support on Aug 12, 2008 01:20
Component adjust its size automatically after data loading, row adding | deleting.
For other type of operation , you can force update of grid size, by adding next command after operation
     grid.setSizes();
It will force update of grid's sizes, and as result autoHeight correction. 
Answer posted by sbritton on Aug 12, 2008 07:54

Thanks...that almost worked.  It will resize the grid, but leaves the scrollbars on the grid.  However, as soon as I click anywhere on the grid the scroll bars disappear.

By the way...I have to say I'm really impressed with the quality of the controls and how quickly support gets back to people with questions.  Very impressive.

Answer posted by Support on Aug 12, 2008 09:34
By any chance - are you using autoHeight and autoWidth mode in same time?
In such case - please contact us directly at support@dhtmlx.com - we will send a fix for such issue. 

If you not using such modes combination - please provide any kind of sample or demom link where issue can be reconstructed.
Answer posted on Aug 12, 2008 09:53

Nope just using autoheight...I assign the widths to match the DIV it resides inside.  All columns are fixed width except the last which is "*".

Unfortunately I can't send a link or exact code because of the privacy concerns of the company.  Let me see if I can scrub something for you.

Answer posted by Support on Aug 13, 2008 03:02
Latest version of dhtmlxgrid.js sent by email, please try to use it instead of original file. 
Also please try to use the next instead of simple grid.setSizes()
     grid.setSizes();
     grid.obj.border=1;
     grid.obj.border=0;

Such code will farse re-rendering grid area in IE, so if problem caused by browser related issues - such code must resolve issue. 
Answer posted by Paul K on Aug 19, 2008 11:00
Your suggested fix:

Also please try to use the next instead of simple grid.setSizes()
     grid.setSizes();
     grid.obj.border=1;
     grid.obj.border=0;

We have a grid control that we can add rows to.  It uses the light skin and auto height is set to true (but not auto width).  With IE 6 when a row is added there are no scroll bars.  With IE 7 when an "odd" row is added (no background color) the right and bottom scrollbars appear even though the newly added row should not need scrolling.  Add an "even" row (with the light background color) and the scroll bars disappear.

When I added the two lines above, this difference between IE 6 and IE 7 went away.

Paul
Answer posted by Support on Aug 20, 2008 03:01
The next lines 
  grid.obj.border=1;
  grid.obj.border=0;
just force rendering of data area of grid, so browser just repaints it without any changes in DOM. It allows to solve some IE related bugs, but not necessary in common case.

If problem stable reconstructable - please provide a code snippet which you are using for grid init and info about used doctypes.