Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:27:50+00:00 2026-05-24T14:27:50+00:00

I have a table structure as follows. Now I need to sort these nested

  • 0

I have a table structure as follows. Now I need to sort these nested tables separately. Forexample: sorting chapter’s row will only update chapters order in a separate table. Whereas, sorting items will update their order in another table.

I managed to setup the code and sorting. However, when I drag the items from chapter 4, it pass on the order of the items in from chapter 1 since they come before chapter 4???

Could someone help me with sorting only relevant items??

NOTE: This list is dynamic coming from database. So I am interested in one jquery code covering all the ordering bits.

        <table id=subsortsortable>
        <tbody class=content>
            <tr id="chapter_1"><td>Chapter one</td></tr>
            <tr id="chapter_2"><td>Chapter two</td></tr>
            <tr id="chapter_3">
                <td>
                    <table>
                        <tbody class=subcontent>
                            <tr id="item_31"><td>three.one</td></tr>
                            <tr id="item_32"><td>three.two</td></tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr id="chapter_4">
                <td>
                    <table>
                        <tbody class=subcontent>
                            <tr id="item_41"><td>four.one</td></tr>
                            <tr id="item_42"><td>four.two</td></tr>
                            <tr id="item_43"><td>four.three</td></tr>
                            <tr id="item_44"><td>four.four</td></tr>
                            <tr id="item_45"><td>four.five</td></tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr id="chapter_4"><td>Chapter Four</td></tr>
        </tbody>
    </table>

The code I am using is as follows:

//for sorting chapters - which is outer table
$("#subsortable tbody.content").sortable({      
        opacity: 0.7, 
        cursor: 'move', 
        placeholder: "ui-state-highlight",
        forcePlaceholderSize: true,
        update: function(){
            var order = $('#subsortable tbody.content').sortable('serialize') + '&action=updateChaptersOrder';
            $.post("/admin/ajax/ajax_calls.php", order, function(theResponse){
            });

        }

    });

// For sorting and updating items within a specific chapter - which is nested tbody
$("tbody.sortItems").subcontent({

        opacity: 0.7, 
        cursor: 'move', 
        placeholder: "ui-state-highlight",
        forcePlaceholderSize: true,
        update: function(){
            var order = $('tbody.subcontent').sortable('serialize');// + '&action=updateListings';
            $.post("/admin/ajax/ajax_calls.php", order, function(theResponse){
            });

        }

    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:27:50+00:00Added an answer on May 24, 2026 at 2:27 pm

    I have got the answer to my own question.. In case someone else encounter the same problem. I have changed the following code inside the internal table:

    var order = $('tbody.subcontent').sortable('serialize'); 
    

    to

    var order = $(this).sortable('serialize'); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table structure that looks like: <table> <tr id=row1> <td> <div>row 1
I have some table structure: <tr class=row-2><tr> <tr class=row-3>..<tr> <tr class=row-4>..<tr> <tr class=row-5>..<tr> <tr
I have a database table structure as follow: datatype data mytable now datatype has
I have table structure as follows id productid ip hittime --------------------------------------------------------------------------- 1 5 1.1.1.1
I have the following table structure as follows: (please ignore the blackbox. was formatting
I have a table structure as follows and I want to select all active
I have the following table structure ZoneID int ZoneName varchar(50) I need to get
Problem Assumption: I have a table in SQL Server, with the structure as follows;
I have four tables: groups, users, votes, follows. The structures of these tables are
We have two tables resembling a simple tag-record structure as follows (in reality it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.