Skip to content

Instantly share code, notes, and snippets.

@bcherny
Last active August 29, 2015 13:56
Show Gist options
  • Save bcherny/9008305 to your computer and use it in GitHub Desktop.
Save bcherny/9008305 to your computer and use it in GitHub Desktop.
ng-grid gotchas

1. To set minWidth or maxWidth, you need to set width to auto as well

good:

...
columnDefs: [
   { field: 'foo', width: 100 },
   { field: 'bar', width: 'auto', minWidth: 100 },  
   { field: 'baz', width: 'auto', maxWidth: 100 },
...

bad:

...
columnDefs: [
   { field: 'bar', minWidth: 100 },  
   { field: 'baz', maxWidth: 100 },
...

2. ng-grid doesn't compute dimensions properly when rendering on a hidden canvas

grid.$gridServices.DomUtilityService.RebuildGrid(
   grid.$gridScope,
   grid.ngGrid
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment