6

I use Drupal 8, but I can not figure out how to sort views with drag and drop. The client needs to sort the items of the views in a very personal way.

Do you know some way?

4 Answers 4

10

The Draggable Views module might be what you need. There is a version of the module for Drupal 8.

According to the module description,

DraggableViews makes rows of a view "draggable" which means that they can be rearranged by Drag'n'Drop.

I tried the following instructions in the documentation page on a vanilla Drupal 8.2.6 installation, and it worked fine (see screenshot below).

  1. Activate the module and navigate to the edit-page of an existing view.
  2. Now go to the Format section and choose Table.
  3. Make sure you have the "Content: Title" field, place it as your first field.
  4. Add the field "Draggableviews: Content" at the Fields section, place it after the "Content: Title" field.Make sure not to check "Exclude from display"; if you do the view will permit drag and drop but the changes will not be saved.
  5. Add "DraggableViews: Weight" at the Sort criteria section and place it as the first Sort criteria. Save the view and you're done.

enter image description here

4
  • I've already tried it, but it does not let me assign a view with drag and drop as order criteria, in version 7 if you can, but in 8 only lets you sort by weight.
    – Fen Dev
    Feb 27, 2017 at 13:12
  • @FenDev - Sounds a little bit like a bug doesn't it? When draggable views ain't draggable.
    – leymannx
    Mar 1, 2017 at 16:06
  • @FenDev - I have just tried it with success and edited my answer accordingly.
    – dinopmi
    Mar 6, 2017 at 15:33
  • @dinopmi - In point 5 of your answer, when I make the view order interface I choose in the order criterion it only allows me to derive by weight, but in version 7 of drupal lets order a view by a view with Draggable View. I have already commented before that I only left by weight, but that is not functional when you create an interface to sort items from a view
    – Fen Dev
    Mar 8, 2017 at 9:43
1

Have you tried Entityqueue? It is a drag and drop interface, in which you insert nodes and sort them.

You can then use the nodequeue as a relation, and sort criteria in views...

https://www.drupal.org/project/entityqueue

0

You will need to create two set of views (lets say list view and order view) and they both should be sorted by draggableviews:weight. The order list view should be displayed as a table and should have draggableviews:content as one of its fields. See attached example.

Once this is setup, you can go back to list view and click on draggableviews:weight and select the newly created order view as sort order.

Let me know how you go.

STEP 1: enter image description here STEP 2: enter image description here STEP 3: enter image description here

3
  • 1
    In drupal 8 the option "Display sort as" does not appear in configure sort criterion.
    – Fen Dev
    Feb 28, 2017 at 9:47
  • @FenDev - Then this sounds like a bug you should report on drupal.org.
    – leymannx
    Mar 1, 2017 at 16:04
  • The question is clearly about Drupal 8. Why post Drupal 7 solution? Jul 8, 2019 at 4:13
-1

Refer this link, it may help. https://www.drupal.org/node/2824325

1
  • @sarika-They have the same problem as me, they have not yet found the solution
    – Fen Dev
    Mar 8, 2017 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.