5

I need a draggable view that includes draggable sections, where both sections and rows are draggable (see image for reference). The sections are not entities on their own. Ideally, the sections would map to a field attached to the entities being output in the view so that they would be available in views, theming, etc. See attached image for reference.

Is there anything in the drupal world that does this today? Looking for ideas or examples on how best to approach this requirement.

ideal solution

Edit Jan 7, 2013 - this is what I have so far, using entity reference, field collection , and field collection table modules, per user user5950's answer below. It's not exactly what I want, and it becomes slow as you add a lot of items (a lot slower to edit a node with 50+ items), but it is functional.

solution based on entity reference, field collection, and field collection table

  • Check out this page on drupal.org, I'm not sure if it's exactly what you want... and I'm not sure you can drag between groups? I've never done this before, so I can't properly answer. Here is another link as well off of drupal.org. It's all related to the DraggableViews module – inertialmedia May 30 '13 at 18:24
3

I am using the module Entity reference in conjunction with Field collection to achieve that goal. That means you

  1. add a node with an Entity reference field, where you save the rows (if they actually are entities in your case),
  2. attach that Entity reference field to a Field collection.
  3. Now you can use the delta value of the Entity reference field to sort the row and the delta value of the Field collection field to sort the sections.

Note! You can use core's node edit form as sorting interface. If you would like to have more than one sort you could do that adding a node for each sort. Draggable view becomes useless that way.

Here is an example:enter image description here

If you want to have an interface, which does not allow to alter other data than the order you could replace the autocomplete field with text an remove the buttons with hook_form_alter().

  • In your proposed solution, is it possible to create and display section names? – Dave Bruns Oct 22 '13 at 14:31
  • You could add an extra text field to the field collection, where you could set, edit and display a title. – user5950 Oct 22 '13 at 14:59
  • OK, that makes sense, thanks. I haven't used field collections before, so I didn't realize you could just add a field like other entities. I'll try this idea out and see how it goes. – Dave Bruns Oct 22 '13 at 16:20
  • Accepted as best answer for now and added a screenshot of current solution, and a list of modules I'm using. Field collection table makes input a little more streamlined. – Dave Bruns Jan 7 '14 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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