ghiscoding / slickgrid-universal

Slickgrid-Universal is a monorepo which includes all Editors, Filters, Extensions, Services related to SlickGrid usage and is also Framework Agnostic
https://ghiscoding.github.io/slickgrid-universal/
Other
90 stars 29 forks source link

Issue with enableExcelCopyBuffer and Hidden Columns Causing Selection Offset #1634

Closed hwlv closed 3 months ago

hwlv commented 3 months ago

Describe the bug

When using the enableExcelCopyBuffer option set to true in slickgrid-universal, I’ve encountered an issue where selecting a range of cells causes the selection area to be offset if there is a hidden column in the grid. It appears that the hidden column is being included in the calculations, leading to discrepancies between the mouse position and the selected cells.

Reproduction

  1. Set enableExcelCopyBuffer to true.
  2. Add a column with the hidden property set to true.
  3. Attempt to select a range of cells that includes both visible and hidden columns.
image

Which Framework are you using?

React

Environment Info

| Executable          | Version |
| ------------------- | ------- |
| (framework used)    | VERSION |
| Slickgrid-Universal | VERSION |
| TypeScript          | VERSION |
| Browser(s)          | VERSION |
| System OS           | VERSION |

Validations

ghiscoding commented 3 months ago

cc @zewa666

ghiscoding commented 3 months ago

The hidden column property was something that was added not that long ago in the 6pac/slickgrid project but it is not not fully supported. The Grid Presets is much more supported to hide columns.

EDIT

I see major differences between the 2 approaches

  1. hiding a column from ColumnPicker/GridMenu/GridPresets will not create the column at all (array doesn't include hidden cols)
  2. the hidden column definition will however container all columns but skip the hidden cols (we can see below that .l6.r6 col is skipped in the DOM) (array does include hidden cols)

image

image

Another distinction is that if I do a selection from 0,0 to H3, I get a different toCell (notice below to cell 8 vs 9)