角度ng网格行高

Poo*_*ani 21 javascript css angularjs ng-grid

有没有办法根据其内容应用ng-grid中行的高度.有一个选项rowHeight,它改变了所有行的高度.但我希望根据其内容动态行高.

以下是我制作的Plunker,在此我使用了cellTemplate来插入教育领域,但我想根据教育领域细节增加行高.

http://plnkr.co/edit/tQJNpB?p=preview

根据这个链接,这是不可能的:[1] https://github.com/angular-ui/ng-grid/issues/157

但如果有人找到解决方案.....

小智 21

这些类将使表显示为实际表,使用display table-row和table-cell.

.ngCell  {
  display : table-cell;
  height: auto !important;
  overflow:visible;
  position: static;
}

.ngRow {
  display : table-row;
  height: auto !important;
  position: static;
}

.ngCellText{
  height: auto !important;
  white-space: normal;
  overflow:visible;
}
Run Code Online (Sandbox Code Playgroud)

请注意,IE8及更高版本支持此功能.它还覆盖了整个ng网格类,因此在"需要"基础上使用它是明智的:

#myTableId .ngCell {...}
#myTableId .ngRow {...}
...
Run Code Online (Sandbox Code Playgroud)