Skip to content

2.0: The easy way to modify row height dynamically? #1523

@yuezheng

Description

@yuezheng

Hello.
This my current grid show via ng-grid:
currentgrid
There some text was cut because it too long. I want to show unbroken data in each cell, so I add some style for grid:

.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;
}

After setted this style, the grid show like this:
fullgrid
The text show complete. But the style of grid goto irregularity.
Now I want achieve that effect:
In general, after the grid loaded, it show like the frist picture above. If one cell's text too long, when mouse hover or on click, then heighten the row which current cell at, so that it could display complete data.

Now, I binded click event at a cell, to get parent row element in JQuery, then change it css like above.
The code just like:

cellTemplate: '<div class=ngCellText ng-click="transform($event)" ng-bind="row.getProperty(col.field)"></div>'

$scope.transform = (event) ->
  clicked = angular.element(event.target)
  targetRow = clicked.closest('div[class^="ngCell"]').parents('div[class^="ngCell"]').parent()
  // TODO: set new css style for the targetRow

This way is very complex, and can not achiev effect I wanted.
Is there a simple solution?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions