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 #983

Merged
merged 3 commits into from
Jan 20, 2024

Conversation

ghiscoding
Copy link
Collaborator

@ghiscoding ghiscoding commented Jan 20, 2024

  • 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: $alpine-header-unorderable-bg-color (replace $ with -- for CSS var)
  • also referencing an old PR Lock columns out of draggable header re-ordering #64 that brought the original idea
  • this is mostly helpful when your column is the first or last column in the grid, but might not behave the way you want when used in the middle

⚠️ Warnings

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

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

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: `$alpine-header-unorderable-bg-color` (replace `$` with `--` for CSS var)
@ghiscoding
Copy link
Collaborator Author

cc @6pac

@zewa666
Copy link
Contributor

zewa666 commented Jan 20, 2024

looking forward to this one. would make a great fit for the row based edit plugin to lock down the actions column in its place.

@ghiscoding ghiscoding merged commit fbcac63 into master Jan 20, 2024
2 checks passed
@ghiscoding ghiscoding deleted the feat/unorderable-columns branch January 20, 2024 18:50
@6pac
Copy link
Owner

6pac commented Jan 22, 2024

I'm good with this but the issue has always been that if you can't drag a column to a place in the column list, you can drag another column to its left or right and eventually acheive the same thing. I don't care about that, but thought I should just point it out.

@ghiscoding
Copy link
Collaborator Author

I know that point and it is mentioned in the PR, this feature is mostly helpful when you use plugin like checkbox selector (row selection) in which you want to keep the checkboxes column as the first column in the grid

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.

3 participants