ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

make cells as wide as its content

Open codeofsumit opened this issue 10 years ago • 2 comments

I have a big data-set (5k+ rows, 100+ columns) that I'm displaying via ui-grid. Performance is much (LOTS) better than ng-repeat 👍

So I want my table to be horizontally scrollable and have each column to have the width of it's content and as it's a table => have each column the widest with that one of it's cells content has. TL:DR I don't want any content to be eclipsed.

But as our columns are dynamic, I don't have a column definition where you'd specify width: "*" for each column. Is there a way to do this for all columns? To have the max size of it's contents?

codeofsumit avatar Feb 16 '16 11:02 codeofsumit

Hi ,I have the same issue, if i have 1000+ rows with 10 to 30 columns it works fine but if i have 10 rows with 200+ columns it rendering after 2 to 3 minute. some time while horizontal scrolling the data is not visible. some time page become unresponsive.

did you find any solution , or any one have solution please share to us.

ajaiswal595 avatar Feb 17 '16 11:02 ajaiswal595

I don't think we have the same problem. Anyway I solved mine by adding multiple watchers on UI changes and then trigger something like this:

// view changed, recalculate dimensions
$timeout(function() {
  $scope.calcDimensions();
  if($scope.gridApi) {
    $scope.gridApi.core.handleWindowResize();
  }
}, 20);

The calcDimensions column sets the width and height of the container of ui-grid.

It's still not perfect, but it renders fast and the table looks good 98% of the time.

codeofsumit avatar Feb 17 '16 13:02 codeofsumit