angular-ui/ui-grid

Column width reset when updating grid.data - fix

Open

#4,317 opened on Sep 3, 2015

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

Description

Hi,

referencing issue #4005 and fix #4202 . It seems that you have mostly fixed this issue, but missed one detail. When you load grid state from e.g. database it resets columns ' widths to default when updating data.

In my opinion, the solution would be to set column's hasCustomWidth property in uiGridSaveStateService::restoreColumns.

              if ( grid.options.saveWidths ){
                currentCol.width = columnState.width;
                currentCol.hasCustomWidth = true;
              }

Contributor guide