angular-ui/ui-grid

Wrong columns rendered after reload of gridOptions.data

Open

#3,519 opened on May 17, 2015

View on GitHub
 (2 comments) (0 reactions) (0 assignees)JavaScript (5,395 stars) (2,496 forks)batch import
help wantedtype: bug

Description

If you have a wide table with a lot of columns and a horizontal scrollbar, and you scroll all of the way to the right of that table and update the data backing the grid, the wrong columns get rendered. Example: http://plnkr.co/m9dWODm9cqqzscPY09L1. It appears to chop off the last few columns until you adjust the scrollbar to move slightly to the left.

I think it's because GridRenderContainer miscalculates the horizontal scroll percentage in adjustColumns, which leads to the range of viewable columns being off by a few. In the scrollHorizontal function the horizScrollPercentage is calculated using both the canvas width and the viewport width, but in adjustColumns only the canvas width is used. Should both functions be using the same method for determining horizontal scroll percentage?

Contributor guide