Skip to content
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

SortableJS grouping without a nested DOM structure #2406

Open
ricjohn-acosta opened this issue Nov 3, 2024 · 0 comments
Open

SortableJS grouping without a nested DOM structure #2406

ricjohn-acosta opened this issue Nov 3, 2024 · 0 comments

Comments

@ricjohn-acosta
Copy link

ricjohn-acosta commented Nov 3, 2024

Here’s my simplified DOM structure. I would like th elements that share the same data-date attribute to belong to the same SortableJS group. This way, I can drag th elements only within their matching date group, without allowing them to be moved into other groups. Is this possible?

  <thead>
    <tr id="container">
      <th data-date="2024-11-04" id="col1">Column 1</th>
      <th data-date="2024-11-03" id="col2">Column 2</th>
      <th data-date="2024-11-04" id="col3">Column 3</th>
    </tr>
  </thead>

I know that if my DOM structure was the following it would be easier but this would require me to do quite heavy DOM manipulation which I'd like to avoid.

  <thead>
    <tr id="container" data-date="2024-11-04">
      <th data-date="2024-11-04" id="col1">Column 1</th>
      <th data-date="2024-11-04" id="col3">Column 2</th>
    </tr>
    <tr id="container" data-date="2024-11-05">
      <th data-date="2024-11-05" id="col1">Column 3</th>
      <th data-date="2024-11-05" id="col3">Column 4</th>
    </tr>
  </thead>
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