Displaying a Weight field in a table view allows users to arrange the rows using Drupal's tableDrag JavaScript plugin. However, if the view is configured with a grouping field, the view is split into multiple tables, and the Weight module incorrectly gives each table the same DOM ID.

This causes at least two issues:

  • The view's HTML no longer validates.
  • When using jQuery 1.5+ via jQuery Update, only the first of the grouped tables will be made draggable.

The problem appears to be caused by weight_preprocess_views_view_table(), which uses the same DOM ID every time it is called.

The attached patch changes weight_preprocess_views_view_table() to append the view's "id" variable to each DOM ID, making them unique. With this patch in place, draggable table views work as expected even when jQuery Update is enabled.

CommentFileSizeAuthor
weight-duplicate_dom_ids.patch627 byteseromba

Comments

davisben’s picture

Status: Needs review » Fixed

Committed, thanks for the patch!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.