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: add column reorderable option to optionally lock a column #1357

Merged
merged 2 commits into from
Jan 20, 2024

Conversation

ghiscoding
Copy link
Owner

  • we can take advantage of SortableJS filter option which can be used to filter column header with a certain CSS class. When using reorderable: false on a column, SlickGrid will add configurable CSS class to the column header which will be filtered out by SortableJS hence locking the column from being reorderable
  • new options available:
    • Column: reorderable (defaults to true)
    • Grid Option: unorderableColumnCssClass (defaults to "unorderable")
    • CSS/SASS variable for Alpine Theme: $slick-grid-header-unorderable-bg-color (replace $ with -- for CSS var)
  • also referencing an old PR build(deps-dev): bump ts-loader from 8.0.1 to 8.0.2 #64 that brought the original idea

⚠️ Warnings

I did add and set reorderable: false to the following 4 plugins, they can all be overriden when instantiating the plugin via their respective options

  • Checkbox Selector Column (Row Selection)
  • Row Detail
  • Row Move Manager
  • Row Base Editor

brave_RO4KUzXlJ7

- we can take advantage of SortableJS `filter` option which can be used to filter column header with a certain CSS class. When using `reorderable: false` on a column, SlickGrid will add configurable CSS class to the column header which will be filtered out by SortableJS hence locking the column from being reorderable
- new options available:
  - Column: `reorderable` (defaults to true)
  - Grid Option: `unorderableColumnCssClass` (defaults to "unorderable")
  - CSS/SASS variable for Alpine Theme: `$slick-grid-header-unorderable-bg-color` (replace `$` with `--` for CSS var)
- also referencing an old PR #64 that brought the original idea

#### ⚠️ Warnings
I did add and set `reorderable: false` to the following 4 plugins, they can all be overriden when instantiating the plugin via their respective options
- Checkbox Selector Column (Row Selection)
- Row Detail
- Row Move Manager
- Row Base Editor
Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a693965) 99.7% compared to head (be8ecf9) 99.7%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1357     +/-   ##
========================================
+ Coverage    99.7%   99.7%   +0.1%     
========================================
  Files         199     199             
  Lines       21572   21576      +4     
  Branches     7201    7202      +1     
========================================
+ Hits        21492   21496      +4     
  Misses         73      73             
  Partials        7       7             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ghiscoding
Copy link
Owner Author

@zewa666 I added it to Row Base Editor as well and changed default to reorderable: false, all 4x plugins that I've disabled it all have them as a configurable option to each plugin

@zewa666
Copy link
Contributor

zewa666 commented Jan 20, 2024

thats great. how did you came to think of this feature?

@ghiscoding
Copy link
Owner Author

thats great. how did you came to think of this feature?

haha I was just looking at some of opened issues in SlickGrid and see if I can work on some of them and then I remember that old issue to lock columns and took a shot at it. It's easier now that we use SortableJS, they have a good API with an easy filter option. However that locking doesn't have the expected effect when the column is in the middle since other columns can be moved, hence why it works better when column is first/last.

@ghiscoding ghiscoding merged commit 44f6c08 into master Jan 20, 2024
5 checks passed
@ghiscoding ghiscoding deleted the feat/unorderable-columns branch January 20, 2024 19:21
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.

2 participants