0

I have hard time setting up a DraggableViews (DV) view to re-order content. The DV actually does save the weights - they appear correct in the draggable table, but on the user side (when viewed on the site page) the weights are all zero (not retrieved?).

The site is bi-lingual and the content is tagged with a vocabulary. The purpose of the DV is to set the order within a term. In the header there's an exposed filter to allow the admin set the correct sequence within a term.

To my eyes, the query run to generate visitor's view is correct, but I'm not an expert.

Please refer to the attached mockup image to get an idea what's going on. Mockup screen

I have the latest version of DV + Views 3.5.

Has anyone been through this? Does this have a known workaround? Is this module limitation or is it the view set up incorrectly?

Edit:

User-facing View:

SELECT draggableviews_structure.parent AS draggableviews_structure_parent, node.title AS node_title, node.nid AS nid, node.language AS node_language, draggableviews_structure.weight AS draggableviews_structure_weight
FROM 
{node} node
LEFT JOIN {draggableviews_structure} draggableviews_structure ON node.nid = draggableviews_structure.entity_id AND draggableviews_structure.view_name = 'project_reorder' AND draggableviews_structure.view_display = 'page' AND draggableviews_structure.args = '[]'
WHERE (( (node.status = '1') AND (node.type IN  ('project')) AND (node.language IN  ('en')) ))
ORDER BY draggableviews_structure_weight ASC

Sorting UI View

SELECT draggableviews_structure.parent AS draggableviews_structure_parent, node.title AS node_title, node.nid AS nid, node.language AS node_language, draggableviews_structure.weight AS draggableviews_structure_weight
FROM 
{node} node
INNER JOIN {field_data_field_genre} field_data_field_genre ON node.nid = field_data_field_genre.entity_id AND (field_data_field_genre.entity_type = 'node' AND field_data_field_genre.deleted = '0')
LEFT JOIN {draggableviews_structure} draggableviews_structure ON node.nid = draggableviews_structure.entity_id AND draggableviews_structure.view_name = 'project_reorder' AND draggableviews_structure.view_display = 'page' AND draggableviews_structure.args = '{\"field_genre_tid_i18n\":\"1\",\"language\":\"en\"}'
WHERE (( (node.status = '1') AND (node.type IN  ('project')) AND (node.language IN  ('en')) AND (field_data_field_genre.field_genre_tid = '1') ))
ORDER BY draggableviews_structure_weight ASC

Note that the sorting view makes use of arguments (derived from exposed filter), while the user-facing one does not. I would think this might case the problem.

3
  • If this helps: below are the two queries pasted from Views Nov 20, 2012 at 23:33
  • Is this custom built theme ?
    – niksmac
    Nov 21, 2012 at 2:19
  • To a certain extent - yes. Nov 21, 2012 at 9:01

1 Answer 1

1

Solution from Chris (original post):

It worked to me.

" Only solution that worked for me was the following:

  • go to your content type/vocabulary
  • add a weight field (label: weight | machine name: weight | field type: integer
  • edit your sorting view and add sort criteria for your newly added weight field
  • edit your draggable views field and change "Handler" from Native to FieldAPI
  • under Field select your weight field -go to your content view and add the new weight field as you sort criteria

This is the only thing that worked for me. If it doesn't work immediately, just reorder a few items on your draggable view so that the ordering values are reset.

Hope this works for you too. "

2
  • This method works for me (for case with several languages) but with an addition: I added a 'Synchronize translations' option for newly added field. This option is located on content type editing form. May 4, 2018 at 17:15
  • There is no way. One more regression of Drupal 8 compared to Drupal 7!
    – elektrorl
    Feb 25, 2021 at 17:46

Your Answer

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

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