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

Drag and drop of current and next row #64

Open
rn54n opened this issue Jul 9, 2015 · 2 comments
Open

Drag and drop of current and next row #64

rn54n opened this issue Jul 9, 2015 · 2 comments

Comments

@rn54n
Copy link

rn54n commented Jul 9, 2015

Hi,

first of all thank you for TableDnD it's awesome and fast, but I still miss one feautre which would help me a lot in my special case. I have searched now almost all search engines and read a lot of approaches with no success.

What is my problem:

I have a "table". After that I defined a header "thead" and in there I defined my "th". Within tablednd this is not drag or dropable. After that I have a php foreach loop which reads all of my data and writes it into my "tbody" and creates more rows "tr" and so on... The rows can be dragged and dropped easily and very smoothly. But my problem is - I want to drag and drop the current row and the next row together - i can easily give them a unique group tag if necessary.

Additionally I don't want to use nested tables, because I loose the alignment of the columns header!

So far here is my simple code - Is it possible to move both tr's with ID 25 or ID 26?

<table id="myTableToSort_1">
      <thead class="header nodrop">
        <th name="aaa">AAA</th>
        <th name="bbb">BBB</th>
        <th name="ccc">CCC</th>
        <th name="ddd">DDD</th>
      </thead>  
      <tbody>
        <tr id="25">
            <td>values for row 25</td>
            <td>values for row 25</td>
            <td>values for  row 25</td>
            <td>values for  row 25</td>
        </tr>
        <tr id="25">
            <td colspan="4">this row belongs to row 25 and should be moved with row 25</td>
        </tr>
        <tr id="26">
            <td>values for row 26</td>
            <td>values for row 26</td>
            <td>values for row 26</td>
            <td>values for row 26</td>
        </tr>
        <tr id="26">
            <td colspan="4">this row belongs to row 26 and should be moved with row 26</td>
        </tr>
      </tbody>
</table>

Many thanks in advance. Hope someone can help me.

Best Regards
Aaren

@rn54n
Copy link
Author

rn54n commented Jul 9, 2015

Hi,

or is it possible to moving all my tbody's and change that in the jquery.tablednd.js??

<table id="myTableToSort_1">
      <thead class="header nodrop">
        <th name="aaa">AAA</th>
        <th name="bbb">BBB</th>
        <th name="ccc">CCC</th>
        <th name="ddd">DDD</th>
      </thead>  
      <tbody id="25">
        <tr>
            <td>values for row in tbody id 25</td>
            <td>values for row in tbody id 25</td>
            <td>values for  row in tbody id 25</td>
            <td>values for  row in tbody id 25</td>
        </tr>
        <tr>
            <td colspan="4">this row belongs to row 25 and should be moved with tbody id 25</td>
        </tr>
       </tbody>
      <tbody id="26">
        <tr>
            <td>values for row in tbody id 26</td>
            <td>values for row in tbody id 26</td>
            <td>values for row in tbody id 26</td>
            <td>values for row in tbody id 26</td>
        </tr>
        <tr>
            <td colspan="4">this row belongs to row 26 and should be moved with tbody id 26</td>
        </tr>
        </tbody>
</table>

Actually I think going one step up to tbody instead using tr's would do the trick?

Best Regards
Aaren

@rn54n
Copy link
Author

rn54n commented Jul 21, 2015

I finally solved it without using the tablednd anymore. I did it with jquery sortable so far and this works fine. Now I can move two rows together.

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