-
-
Notifications
You must be signed in to change notification settings - Fork 26
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 #309
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 new SlickGrid version has `reRenderColumns` exposed as a public method (it was private before)
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 212 212
Lines 12752 12838 +86
Branches 4363 4403 +40
=========================================
+ Hits 12752 12838 +86
Continue to review full report at Codecov.
|
- move code in Grid Service - add all new Column Definition related to resize - add all new Grid Options related to resize
- also add all necessary resize by content grid options missing
- this latest commit should be the last one on the feature side, it all works now and calculations are properly tweaked. The only left would be to add unit tests for all of this in future commit
- after doing more UI tests, I found that changing freeze column from header menu & clearing pinning was affecting their positions (in some cases resetting them completely) and was also affecting the resize by content width calculation
- also we should not read `column.width` from `getColumns` because SlickGrid will always populate it with its default internal width (80), so we can't realy on that
- 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
changed the title
WIP - feat(resize): add column resize by cell content
feat(resize): add column resize by cell content
Apr 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.TODOs
autosizeColumns
)autosizeColumns
for performance reasons