close
Skip to content

Add enableMoving option to the table layout to allow or disallow column moving left and right#71120

Merged
oandregal merged 5 commits intotrunkfrom
update/dataview-turn-off-movable-columns
Aug 12, 2025
Merged

Add enableMoving option to the table layout to allow or disallow column moving left and right#71120
oandregal merged 5 commits intotrunkfrom
update/dataview-turn-off-movable-columns

Conversation

@mikejolley
Copy link
Contributor

What?

The Table Layout allows columns to be moved left and right. To support more static views using DataViews, this allows the option to move columns left and right to be turned off via layout options.

layout: {
	enableMoving: false,
},

This defaults to true as before. If the column header menu is empty as a result of this, the menu is now not rendered at all.

If the layout option is not best suited for this, please help me choose an alternative location. It should not be at field level because having a mixture of movable/not-movable columns could be confusing.

Why?

I want to be able to turn off filtering, hiding, moving, and sorting on some static data views.

How?

Layout option specific to tables.

Testing Instructions

  1. Open storybook and go to ?path=/story/dataviews-dataviews--fields-no-sortable-no-hidable-no-movable.
  2. Click the title header. No moving options are displayed.
  3. You cannot click the 'description' header. There is no button rendered.
  4. Go to any other dataview and confirm the move left/right options are still visible.

Testing Instructions for Keyboard

Screenshots or screencast

Screenshot 2025-08-07 at 16 45 16

Note, move left and right is missing.

@mikejolley mikejolley self-assigned this Aug 7, 2025
@mikejolley mikejolley requested a review from oandregal as a code owner August 7, 2025 15:46
@github-actions
Copy link

github-actions bot commented Aug 7, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mikejolley <mikejolley@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

Flaky tests detected in ce2f088.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16809297838
📝 Reported issues:

@oandregal oandregal added [Type] Enhancement A suggestion for improvement. [Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond labels Aug 11, 2025
@oandregal
Copy link
Member

Hey, took a look at this and the fields are still movable from the view config menu:

Screen.Recording.2025-08-11.at.13.02.42.mov

I want to be able to turn off filtering, hiding, moving, and sorting on some static data views.

Can you provide more info about this? What do you expect to happen? For example, the view config menu will always be present.

I'll tag this as "needs design feedback" as this falls in the "configurability" camp, and I'm not sure whether this is something we want to support.

@oandregal oandregal added the Needs Design Feedback Needs general design feedback. label Aug 11, 2025
@mikejolley
Copy link
Contributor Author

@oandregal With DataViews you can pass children, making those top menus optional. This is for a use-case where we're using DataViews to show tabular data, but we don't need the view to be altered by the user:

Screenshot 2025-08-11 at 12 14 57

You can see I've turned off search, config etc.

Its not a disaster if we need to leave this functionality in place, but it makes consuming DataViews more complex because we then need to track the view state.

@oandregal
Copy link
Member

I talked with Mike and Jay about this: it's an okay configuration to have.

Additionally, this brought up the use case of "non interactive" DataViews (no search, filters, no controls in table, no layout switcher, and no view config). This is doable today with the "free composition" mode, but we may want to streamline it. For now, I've pushed an update to the story at d4bfd81 so we better track where we are now.

@oandregal oandregal enabled auto-merge (squash) August 12, 2025 08:18
@oandregal oandregal merged commit 2826f74 into trunk Aug 12, 2025
69 checks passed
@oandregal oandregal deleted the update/dataview-turn-off-movable-columns branch August 12, 2025 08:28
@github-actions github-actions bot added this to the Gutenberg 21.5 milestone Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] DataViews Work surrounding upgrading and evolving views in the site editor and beyond Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants