WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.4k stars 4.16k forks source link

[DataViews] Reordering Items? #61751

Closed dannyreaktiv closed 4 weeks ago

dannyreaktiv commented 4 months ago

What problem does this address?

Is there anything on the DataViews roadmap to include reordering items via drag and drop?

What is your proposed solution?

Allow for items be rendered via drag and drop. In Table view that would mean reordering rows and in Grid that would mean having the cards be reorderable.

jameskoster commented 4 months ago

I assume this would be a way to manipulate the order value for pages? What would it do on other data views like Templates or Patterns?

In general I'm not sure this is really compatible with the sorting functionality in data views. What happens if you sort by publish date then drag and drop to re-order?

It would be helpful to unpack the feature a little more if you have the time :) Why do you need drag and drop here?

dannyreaktiv commented 4 months ago

@jameskoster Thanks for replying. I've got all the time in the world :)

The need is to have a component that provides an array of post IDs for a block to render the posts in a specific order. (Kind of like Query Loop with a $post__in )

  1. Allow users to select which posts they want.
  2. Allow users to reorder the posts.

DataViews is a beautiful component, so I was hoping to be able to leverage it.

ntsekouras commented 4 months ago

I think it's more likely to have the ability to pin items, which could produce similar results with the behavior you're describing. Would that work for your use case?

jameskoster commented 4 months ago

@dannyreaktiv my interpretation is slightly different to Nik's, I think. I want to fully understand.

It sounds to me that you'd like to have a block that shows a specific set of posts. In the configuration view for that block the posts are displayed using the data view component. Users can drag/drop posts to change the order that the block displays them in.

If that's correct, I'd ask; why not allow users to re-order on the canvas, similar to how images can be re-ordered in Gallery blocks? Otherwise I'm struggling to see a similar use case for core data views, so I'm not sure how it would fit into the roadmap.

dannyreaktiv commented 4 months ago

@jameskoster Thanks for getting back to me.

I hadn't considered reordering on the canvas. Thanks for the idea!

annezazu commented 4 weeks ago

Noting that for data views, reorder columns has been recently merged: https://github.com/WordPress/gutenberg/pull/64381 I'm going to close this out as it seems to have been more of a back and forth about data views rather than a request. If that's wrong, let's reopen and get more clarity :)