Skip to content Skip to sidebar Skip to footer

How To Display The New Order Of The Parent After Sorting?

Here are my current codes. These codes sort both parent and child but it display only the new order of the child after sorting. template

    If you look at your jQuery, you'll see this line:

    $(".dropenv").sortable({
    

    This is applying the sortable behavior to any element with a class of .dropenv. It's here that you're initing the custom stop event handler which updates the #cl tag.

    However, you're only applying this behavior to elements with a class of .dropenv, which, reviewing your html for the parent:

    <ul id="envelopes"class="dropcat cat-data">
    

    The parent UL doesn't match.

    Instead, you're applying an entirely new sortable behavior to the parent:

        $( "ul.dropcat").sortable({
            connectWith: "ul.cat-data",
            dropOnEmpty: true,
        });
    

    Which has none of the custom stop handler code contained within it.

    So either copy the stop handler code from the .dropenv sortable options into the one above, or make the .dropenv sortable apply to your .dropcat UL as well.

Post a Comment for "How To Display The New Order Of The Parent After Sorting?"