Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(resize): add column resize by cell content #560

Merged
merged 11 commits into from
Apr 28, 2021

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Apr 17, 2021

  • a quick description of the problem, by default the auto-resize will call the grid.autosizeColumns() which will try to find all columns in the grid viewport and that works ok with a small grid but as soon as we have many columns, it starts to wrap many words (with ellipsis) and some user might prefer to resize the column by the cell content (to match the content width with the cell width) and that might mean going wider than the grid viewport.
  • so this will be an opt-in feature since it will loop through the entire dataset (by default it will read no more than the first 1000 rows) and find/calculate the width it needs to show the entire text value without word being wrapped, in some cases when having many columns it might make the grid wider than the viewport (in that case the horizontal scroll will appear)

TODOs

  • create POC code
  • add new method in Grid Service
  • add grid option to choose which resize type to use (currently defaults to use only the autosizeColumns)
    • default should still always be to use autosizeColumns for performance reasons
  • add full unit tests coverage
  • add Cypress E2E tests
  • requires newer version of Slickgrid-Universal

- a quick description of the problem, by default the auto-resize will call the `grid.autosizeColumns()` which will try to find all columns in the grid viewport and that works ok with a small grid but as soon as we have many columns, it starts to wrap many words (with ellipsis) and some user might prefer to resize the column by the cell content (to match the content width with the cell width) and that might mean going wider than the grid viewport.
- so this will be an opt-in feature since it will loop through the entire dataset (by default it will read no more than the first 1000 rows) and find/calculate the width it needs to show the entire text value without word being wrapped, in some cases when having many columns it might make the grid wider than the viewport (in that case the horizontal scroll will appear)
- the editor custom formatter was having a lot more space compare to without, this commit fixes it and now they both have the same cell width
- also found the `resizeMaxWidthThreshold` was inversed when comparing against it
- lastly improve performance by skipping column with fixed `width`
@ghiscoding ghiscoding changed the title WIP - feat(resize): add column resize by cell content feat(resize): add column resize by cell content Apr 28, 2021
@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #560 (690fa68) into master (12e420a) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #560   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines         1187      1264   +77     
  Branches       353       390   +37     
=========================================
+ Hits          1187      1264   +77     
Impacted Files Coverage Δ
...lia-slickgrid/custom-elements/aurelia-slickgrid.ts 100.00% <100.00%> (ø)
src/aurelia-slickgrid/services/resizer.service.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12e420a...690fa68. Read the comment docs.

@ghiscoding ghiscoding merged commit f5211c3 into master Apr 28, 2021
@ghiscoding ghiscoding deleted the feat/auto-resize-by-cell-content branch April 28, 2021 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant