Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#37 | 2422737-37.patch | 306 bytes | _utsavsharma |
#37 | interdiff_36-37.txt | 382 bytes | _utsavsharma |
#36 | 2422737-36.patch | 306 bytes | DieterHolvoet |
Comments
Comment #1
JulienF CreditAttribution: JulienF commentedFind the attached patch... it might help others
Comment #2
David_Rothstein CreditAttribution: David_Rothstein commentedMoving to "needs review" since there's a patch. Pretty sure this would be relevant for Drupal 8 also, though?
Comment #3
David_Rothstein CreditAttribution: David_Rothstein commentedComment #4
JulienF CreditAttribution: JulienF commentedMost probably useful in Drupal 8 if tabledrag isn't being updated with such management.
Comment #5
dcam CreditAttribution: dcam commentedTagging to get the attention of the JS people.
Comment #6
droplet CreditAttribution: droplet commentedThis is an API changes, too late for D7 :(
Comment #7
torotil CreditAttribution: torotil at more onion commentedHere 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?
Comment #8
torotil CreditAttribution: torotil at more onion commentedComment #9
nod_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.
Comment #14
kwoxer CreditAttribution: kwoxer commentedNeeds a re-roll. The both function have been changed in some ways that needs to be verified if the trigger is still needed.
Comment #15
torotil CreditAttribution: torotil at more onion commentedSorry I’m not using D8 at the moment and that’s not going to change soon. So unless someone else steps up this won’t happen.
Comment #18
selva.swamy@gmail.com CreditAttribution: selva.swamy@gmail.com as a volunteer and commented@torotil: Is is possible to work on this now? Any updates?
Comment #19
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #20
uzlov CreditAttribution: uzlov at Skilld commentedActually, is no any changes. Added "change" event to each table item (row) after dragging elements. Tested.
Comment #21
uzlov CreditAttribution: uzlov at Skilld commentedComment #22
Erik FrèrejeanPatch applies and the event seems to work.
Comment #23
larowlanCan we get a test here folks, so we don't lose the functionality
Comment #25
selva.swamy@gmail.com CreditAttribution: selva.swamy@gmail.com as a volunteer and commentedCould someone please provide the tests required here? I am having issues in setting up Nightwatch since I am using Windows.
Comment #30
quadrexdevApplied the patch from #20 on my Drupal 9.3 project and it works like a charm.
Thanks uzlov!
Comment #32
Suresh Prabhu Parkala CreditAttribution: Suresh Prabhu Parkala at Specbee commentedre-rolled patch to the latest 9.5.x.
Comment #35
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedRe-rolled patch against 11.x.
Comment #36
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedI rewrote the patch to trigger a change event a. without jQuery and b. on the select element carrying the delta instead of the row div. That makes more sense IMO.
Comment #37
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs for DrupalFit commentedFixed failures in #36.