dgrid icon indicating copy to clipboard operation
dgrid copied to clipboard

Column not being displayed sometimes when using ColumnHider and ColumnResizer

Open fuje opened this issue 9 years ago • 2 comments

When a column is resized and then an action to display a hidden column is performed, sometimes the column that was supposed to be displayed doesn't show up. I've written a simple JSFiddle where it can be reproduced. Note that after the issue occurs, if a resize in the other columns is performed, the column that should have been displayed and was hidden before may be rendered as expected.

fuje avatar Aug 11 '15 16:08 fuje

Thanks for the example. It made it easy to track down the issue.

Steps to reproduce are:

  1. resize the grid so the column headers are wider than the available space in the grid (i.e. expand Last Name until Color is partially off the screen)
  2. Open the hider menu and unhide Age
  3. NOTE: If Last Name or other columns are shrunk then Age will reappear when all columns can be fully shown.

Expected: Age should appear to the right of Last Name and push Color off screen Actual: Age does not appear

The problem at hand is ColumnResizer captures the initial width of each column the first time the grid is resized. When a column is hidden ColumnResizer does not calculate its initial width.

A simple way to inform ColumnResizer of a column's baseline is to set a width for all cells via CSS:

.dgrid-cell {
    width: 100px;
}

Here's a Working JSFiddle example.

devpaul avatar Aug 17 '15 19:08 devpaul

I have a simple reproduction for 1.1.0: http://jsfiddle.net/ncppy6ex/6/

Normally I try to include a gist containing a fix but I'm not sure what the correct behavior is in this case. What width should the column be given?

dmartin-gh avatar Jul 11 '16 19:07 dmartin-gh