Skip to content

Enhance DataTableColumns ordering options #7193

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

Merged
merged 10 commits into from
Apr 15, 2024

Conversation

ganondev
Copy link
Contributor

@ganondev ganondev commented Apr 9, 2024

Clones #7178

This is a partial, draft, PR to enhance DataTableColumns to disallow changing the order of selected columns.

Closes #7170

A new attribute, pinOrder, can be specified in an object in the options property. This attribute pins the order of this column in DataTableColumns.

This is implemented using the existing pinned property of the List component.

Here is a description of requirements provided by Taylor Seamans:

  1. Whichever item is effectively the “first” reorderable item should have the up arrow button disabled
  2. If an item that isn’t the leftmost is not reorderable, then the items around it should shift while keeping its order fixed
  3. This behavior should work for both drag + drop as well as using the arrow keys

What does this PR do?

Where should the reviewer start?

What testing has been done on this PR?

How should this be manually tested?

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Screenshots (if appropriate)

image

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Is this change backwards compatible or is it a breaking change?

kimkscott and others added 2 commits March 28, 2024 11:54
This is a partial, draft, PR to enhance DataTableColumns to
disallow changing the order of selected columns.

This PR addresses this issue: grommet#7170

A new attribute, pinOrder, can be specified in an object in
the options property.  This attribute pins the order of this
column in DataTableColumns.

This is implemented using the existing pinned property of the
List component.

Here is a description of requirements provided by Taylor Seamans:
1. Whichever item is effectively the “first” reorderable item should have the up arrow button disabled
2. If an item that isn’t the leftmost is not reorderable, then the items around it should shift while keeping its order fixed
3. This behavior should work for both drag + drop as well as using the arrow keys
@ganondev
Copy link
Contributor Author

ganondev commented Apr 9, 2024

Screenshot after renaming pinOrder to pinned
image

@britt6612
Copy link
Collaborator

@ganondev
Thinking of a good test for this maybe we can add
scenario: 'pinned' second column

1. pressing `up arrow` on third column should result in third column now as first and first column now as third.
2. dragging third column up should result in third column now as first and first column now as third.
3. up/down arrows should not exist for `pinned` column

Similar to this test lmk if you need help!
https://github.com/grommet/grommet/blob/master/src/js/components/List/__tests__/List-test.js#L921

Also we decided on a styling but I will do those changes in a separate PR so we don't hold this up.

Copy link
Collaborator

@taysea taysea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking really good, just dropped one small comment.

ganondev and others added 2 commits April 12, 2024 16:39
Co-authored-by: Taylor Seamans <taylor.seamans@yahoo.com>
Copy link
Collaborator

@britt6612 britt6612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@britt6612 britt6612 requested a review from taysea April 12, 2024 21:09
@ganondev ganondev requested a review from taysea April 15, 2024 14:02
Copy link
Collaborator

@taysea taysea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Collaborator

@halocline halocline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ganondev for your contribution!

@halocline halocline merged commit bba7164 into grommet:master Apr 15, 2024
@taysea taysea mentioned this pull request Apr 24, 2024
3 tasks
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.

Enhance DataTableColumns to disallow changing the order of some columns
6 participants