Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jun 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation sorting of a parent with child using jquery ui sortable

    Got this piece of code of coldfusion

    Code:
    <ul id="sortable">
            <set counter=1>
            <loop query="myquery" group="ID">
                <li id="item-1134" data-id="1133|1122|1121" class="ui-state-default">
                    <table width="100%" border="0">
                    <tr>
                        <td width="5%">#counter#</td>
                        <td width="10%">1134</td>
                        <td width="35%">Text</td>
                        <td width="15%">name</td>
                        <td width="12%">Edit</td>
                        <td width="13%">Disable</td>
                        <td width="10%">Delete</td>
                    </tr>
                    </table>
                </li>
                <set counter++>
            </loop>
        </ul>
    two things to not here is the
    Code:
    id="item-1134" data-id="1133|1122|1121"
    id is carrying the parent and the data-id are carrying the children. all i am trying to do is when i move parent, it should move its children too and children can be moved within the parent but not outside the parent.

    its more of a jquery code rather than coldfusion but here is the js code:

    Code:
    $("#sortable").sortable({
                    stop: function(event,ui){
                        var info = $(this).sortable("serialize");
                        $.post('sort.cfm', info, function(){
    
                        });
                    },
                    activate: function(event,ui){
                        for (var i = $('.ui-state-default').length - 1; i >= 0; i--){
                            $('.pull-left:eq('+i+')').html(i+1);
                        };
                    }
                });
    in the cfm file of database, all is done is set up a counter and that counter is updated, so i assume that also needs to be changed but that is more of a cf question

    so how can i fix this with jquery ui
    Last edited by vinyl-junkie; Jun 10th, 2018 at 07:14 PM. Reason: corrected code tags


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •