angular-ui/ui-grid

handleWindowResize doesn't work properly when footer visibility changes at runtime

Open

#4,801 opened on Dec 2, 2015

View on GitHub
 (2 comments) (0 reactions) (0 assignees)JavaScript (5,395 stars) (2,496 forks)batch import
good first issue

Description

I need to toggle the visibility of the grid footer by user request, so I basically change the showColumnFooter value then call handleWindowResize and refresh to resize and upgrade the grid. The grid rests inside a div in a full flexible layout with stuff above and below so it's important to adjust the size properly, but something is not working:

  • If the footer is hidden at startup, showing it (i.e. setting showColumnFooter=true) will cause the grid to exceed the container height.
  • If the footer is initially visible instead, hiding it (showColumnFooter=false) will leave an empty space at the bottom.
  • The miscalculated height is persistent: any subsequent call to handleWindowResize and refresh won't fix the problem.

I've made a very simplified version of my layout in this plunkr: by playing with the buttons to toggle the footer and change the container size you can see exactly what the problem is.

Contributor guide