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

[XGrid] Disable reordering on a specific column #1161

Closed
efreethy opened this issue Mar 4, 2021 · 5 comments · Fixed by #2085
Closed

[XGrid] Disable reordering on a specific column #1161

efreethy opened this issue Mar 4, 2021 · 5 comments · Fixed by #2085
Assignees
Labels
new feature New feature or request

Comments

@efreethy
Copy link

efreethy commented Mar 4, 2021

First off: great work with this product.

I have a custom checkbox column - I am not using the checkbox built ins. This column should not be reorderable, however there is no ColDef option to specify that. The other areas of column functionality are optional (resizable, sortable, etc). It makes sense to also have a "reorderable" col def option.

@efreethy efreethy added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 4, 2021
@DanailH
Copy link
Member

DanailH commented Mar 4, 2021

Hi, @efreethy thanks for raising this. When we were working on the column reorder feature we were considering that case. Our argument of not adding it was that even if you make one column not reorderable you could still reorder the columns around it which will indirectly move your non-reordarable column so it won't truly be non-reorderable.

I'm interested to hear your thoughts on this?

@efreethy
Copy link
Author

efreethy commented Mar 4, 2021

thanks for the quick response @DanailH

I imagine a non-reorderable column as essentially a pinned column. When such a column is involved as a subject in a reorder - its ordinal position is not allowed to change, therefore the ordinal positions of all the other columns would rotate around it.

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 4, 2021

even if you make one column not reorderable you could still reorder the columns around it which will indirectly move your non-reordarable column so it won't truly be non-reorderable.

@DanailH We should be cautious here. There are two different concepts:

  1. Is the column draggable?
  2. Is the position of the column fixed?

AG Grid illustrates the two different notions well.

@oliviertassinari oliviertassinari changed the title [DataGrid] "Reorderable" ColDef option does not exist [XGrid] "Reorderable" ColDef option does not exist Mar 4, 2021
@oliviertassinari oliviertassinari added new feature New feature or request and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 4, 2021
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 4, 2021

As far as I understand the pain:

  1. We could update GridColDef with:
  /**
   * If `true`, the column cannot be dragged for reordering.
   */
  disableReorder?: boolean;

Its name matches the name of the global flag: disableColumnReorder.

  1. We could update the column def with:
  /**
   * If `true`, the position of the column is locked. Reordering can't change it.
   */
  lockPosition?: boolean;

This would both impact the header dragging feature and the column selector reorder: #839.

I was hoping that none of these two options would be necessary with a controllable pattern (developers handling the reorder callback and keeping the previous state) but unfortunately, only 2 could be implemented this way, combined with 1.

@oliviertassinari oliviertassinari added the waiting for 👍 Waiting for upvotes label Mar 4, 2021
@oliviertassinari oliviertassinari changed the title [XGrid] "Reorderable" ColDef option does not exist [XGrid] Disable reordering on a specific column Mar 4, 2021
@oliviertassinari
Copy link
Member

I am not using the checkbox built-in

@efreethy Out of curiosity, why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants