I'd like to be able to adjust the height of the grid container to fit the number of rows returned from a query (JSON). I've added the code in an onLoad handler which includes:
This works correctly, except that when the column widths are adjusted the horizontal scroll bar is not visible (if the new height is less than the default height of the container).
// set the height for the number of rows + the header height + room for scrollbar (i.e. rows*21px + 52px)
var ht = 52 + this.dataModel.getRowCount()*21;
YAHOO.util.Dom.setStyle('my-grid', 'height', '' + ht + 'px');
Also, if the default height of the container is too small for the number of rows then only the number of rows that can fit in the original height are displayed and no vertical scrollbar is displayed.
Obviously I'm missing something vital, so what is the correct way to adjust the height of the container so that the scroll bars work and all the rows fit correctly?