My code is as below:
<div class="gridStyle" ng-grid="gridOptions" ng-show="flag"></div>
when i set the flag to true, the grid cannot render correctly, if you press F12 on the keyboard, it can show correctly!
My code is as below:
<div class="gridStyle" ng-grid="gridOptions" ng-show="flag"></div>
when i set the flag to true, the grid cannot render correctly, if you press F12 on the keyboard, it can show correctly!
i also find a solution: use ng-if
instead of ng-show
/ng-hide
, like this:
<div class="gridStyle" ng-grid="gridOptions" ng-if="flag"></div>
Using ng-if
also fiexed it for me!
While I realize this question has aged, none of the solutions worked for me as of today. However, using the ui-grid-auto-resize attribute on my element worked like a charm.
<div ui-grid="gridOptions" class="grid" ui-grid-auto-resize></div>
ng-grid and ui-grid don't automatically update the table when hidden or shown. By calling gridApi.core.refresh();
(for ui-grid) and gridOptions.ngGrid.buildColumns();
(for ng-grid) you force the library to rebuild the table according to the current DOM situation