Skip to content

[Feature] Request: Make The "draggable" Property A Selector So That Descendant Elements Enable Draggging, Not Just Direct Child Elements #2433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
WoofGrrrr opened this issue Mar 29, 2025 · 0 comments

Comments

@WoofGrrrr
Copy link

WoofGrrrr commented Mar 29, 2025

My sortable list is a table (TABLE element,) and I would like for the draggable elements in that table to be the individual tables cells (TD elements,) not the entire rows (TR elements.) Some of the cells in my table contain buttons or checkboxes, etc, and I would like for the spaces in the cells around those elements to NOT allow dragging.

The docs on the README page say this:

draggable: ".item", // Specifies which items inside the element should be draggable

It doesn't say whether it can be a selector or just a class.

This is a very simplified template for my Sortable list:

<table class="identity-list">
  <tr class="identity-item">
    <td class="identity-item-controls-wrapper">
      <input type="checkbox" class="identity-item-check" identityId="item1">Check 1
    </td>
    <td class="identity-id identity-item-draggable">
      item1
    </td>
    <td class="identity-name identity-item-draggable">
      Identity #1 Name
    </td>
    <td class="identity-item-controls-wrapper">
      <input type="checkbox" class="identity-item-check" identityId="item1">Check 2
    </td>
  </tr>
</table>

I tried using a selector like this:

draggable: ".identity-item > .identity-item-draggable"

It does not work.

I also tried simply this:

draggable: ".identity-item-draggable"

It also does not work.

I then moved the identity-item-draggable class to the table rows (the TR elements) instead, and that DOES work.

So I would like to request that it be made to work for a selector that matches any descendant elements. But that would probably be very difficult...

@WoofGrrrr WoofGrrrr changed the title Request: Make The "draggable" Property A Selector So That Descendant Elements Enable Draggging, Not Just Direct Child Elements [Feature] Request: Make The "draggable" Property A Selector So That Descendant Elements Enable Draggging, Not Just Direct Child Elements Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant