angular-ui/ui-grid

Column width by percentage does not account for selection column

Open

#6,093 opened on Mar 17, 2017

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

Description

Expected Behavior When defining columns with percentage widths, if the columns defined in gridOptions.columnDefs add up to a total of 100%, they will fill up and not overflow the grid viewport.

Actual Behavior If ui-grid-selection is being used, the columns will overflow the grid viewport by the width of the selection column.

The selection column is a part of the grid control itself and not the data display, as evidenced by not being defined in columnDefs, so its size should be accounted for when calculating the size of the viewport, much like the vertical scroll bar is.

This plunker illustrates the issue by defining one 100% width column in a selectable grid: http://plnkr.co/edit/BcV3qI64mMOnNMdDAjPM?p=preview

You will have to enter app.js and change enableRowHeaderSelection to false to see that the sizing is correct when the selection row header is removed, as indicated by the comment there. (I tried to wire up a button to do this, but couldn't get the grid to recognize the change.)

Contributor guide