Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-grid height in %. 100% of parent container

In the ng-grid i need to set the height to 100% so that it is always of the height of the parent container(another div wrapping the grid div) even on window resize. How do i Do it ? {height : 100%} does not resolve this?

like image 931
Bhumi Singhal Avatar asked May 09 '14 05:05

Bhumi Singhal


2 Answers

This is what worked for me.

.ui-grid {
  position: absolute;
  height: auto;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

Someone in this thread, linked by @dcryan22, mentioned a partial version of this answer. I figured it would be helpful to include the actual full code from the solution here in an answer.

Note that these properties are set on the child element .ui-grid, not just the directive itself.

like image 131
Jason Swett Avatar answered Nov 17 '22 15:11

Jason Swett


This article gave the answer of using CSS viewport. Works perfectly for me!

I added this to the CSS:

.ui-grid {
    height: 98vh;
}

I'm using twitter bootstrap as well, but didn't even need any extra divs or containers.

like image 3
BoomShadow Avatar answered Nov 17 '22 15:11

BoomShadow