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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JulienF’s picture

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

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.

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

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

kwoxer’s picture

Status: Needs review » Needs work

Needs a re-roll. The both function have been changed in some ways that needs to be verified if the trigger is still needed.

torotil’s picture

Sorry 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.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.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.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

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

selva.swamy@gmail.com’s picture

@torotil: Is is possible to work on this now? Any updates?

jrockowitz’s picture

uzlov’s picture

Actually, is no any changes. Added "change" event to each table item (row) after dragging elements. Tested.

uzlov’s picture

Status: Needs work » Needs review
Erik Frèrejean’s picture

Version: 8.6.x-dev » 8.8.x-dev
Status: Needs review » Reviewed & tested by the community

Patch applies and the event seems to work.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Can we get a test here folks, so we don't lose the functionality

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

selva.swamy@gmail.com’s picture

Issue tags: -JavaScript +JavaScript

Could someone please provide the tests required here? I am having issues in setting up Nightwatch since I am using Windows.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quadrexdev’s picture

Applied the patch from #20 on my Drupal 9.3 project and it works like a charm.

Thanks uzlov!

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Suresh Prabhu Parkala’s picture

FileSize
1.86 KB

re-rolled patch to the latest 9.5.x.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

DieterHolvoet’s picture

DieterHolvoet’s picture

FileSize
306 bytes

I 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.

_utsavsharma’s picture

Fixed failures in #36.