There is no easy way to attach a listener to an element being dragged when a tabledrag widget is being used.

I needed this functionality to have a lightweight listener on an element of a tabledrag being dragged so I added a small patch.

Files: 
CommentFileSizeAuthor
#7 drupal-2422737-7-send-change-events-after-tabledrag.patch697 bytestorotil
PASSED: [[SimpleTest]]: [MySQL] 41,478 pass(es). View
#1 2422737-tabledrag_event_after_drag-1.patch508 bytesJulienF
PASSED: [[SimpleTest]]: [MySQL] 41,089 pass(es). View

Comments

JulienF’s picture

FileSize
508 bytes
PASSED: [[SimpleTest]]: [MySQL] 41,089 pass(es). View

Find the attached patch... it might help others

David_Rothstein’s picture

Status: Active » Needs review

Moving to "needs review" since there's a patch. Pretty sure this would be relevant for Drupal 8 also, though?

David_Rothstein’s picture

Version: 7.34 » 7.x-dev
JulienF’s picture

Most probably useful in Drupal 8 if tabledrag isn't being updated with such management.

dcam’s picture

Issue tags: +JavaScript

Tagging to get the attention of the JS people.

droplet’s picture

Version: 7.x-dev » 8.0.x-dev
Component: other » javascript
Status: Needs review » Needs work

This is an API changes, too late for D7 :(

torotil’s picture

Version: 8.0.x-dev » 7.x-dev
Related issues: +#2239961: Allow contrib javascripts to react on tableselect and permission page
FileSize
697 bytes
PASSED: [[SimpleTest]]: [MySQL] 41,478 pass(es). View

Here is a patch that adds a simple change event after the weights have been changed. (No API change!)

Manipulating the values of form elements without triggering at least a change-event prevents other javascripts from reacting to those changes. IMHO this is even a bug.

Also see #2239961: Allow contrib javascripts to react on tableselect and permission page for another issue like this. Maybe we could merge those two?

torotil’s picture

Status: Needs work » Needs review
nod_’s picture

Version: 7.x-dev » 8.0.x-dev

We could add that to core and here it may even be a bug but first we have to fix this in D8 and backport to D7 once it's in D8.

The D7 backport will need some serious testing because I don't know what kind of JS listen to the change event in tabledrag but it's probably not pretty.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.