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.
| Comment | File | Size | Author |
|---|---|---|---|
| weight-duplicate_dom_ids.patch | 627 bytes | eromba |
Comments
Comment #1
davisbenCommitted, thanks for the patch!