Description
I want a grid to have a height relative to the window. For that I wrote a little directive which works in principle. When I resize the browser, the grid height changes smoothly.
The problem is the initial rendering without resizing the browser: the grid is resized correctly, but the ui-grid-render-container is not.
I've prepared a plunk demonstrating my issue: http://plnkr.co/edit/1XJY8wlamohk25yec5Sm?p=preview (In defense, the directive and HTML structure are a little simplified, but the effect is the same. The ng-if="1" simulates ui-views.)
There are two "switches" which affect the behavior: The $timeout in the directive and the ng-if="1" on the div surrounding the grid. The following happens:
Without ng-if="1" and without $timeout everything works fine.
Without ng-if="1" and with $timeout the grid resized, but not the render-container.
With ng-if="1" and without $timeout nothing is resized.
With ng-if="1" and with $timeout the grid resized, but not the render-container.
Sadly, I cannot get rid of ng-if="1" or rather its equivalent ui-view.
Is there anything in the directive/structure I can do to solve this or can this be fixed inside ui-grid? It seems strange that the grid and rendering container can be of different size.