⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Image Crud - ordering on upload



Mark Hughes

Mark Hughes
  • profile picture
  • Member

Posted 13 April 2013 - 17:42 PM

Hello,

 

A quick question from someone who sometimes struggles with javascript.  For various reasons I need to know the order of uploaded files even if the user has not changed the order yet.  I can see that the ordering is triggered by the following js: 

 

 

$(".photos-crud").sortable({
                handle: '.move-box',
                opacity: 0.6,
                cursor: 'move',
                revert: true,
                update: function() {
                    var order = $(this).sortable("serialize");
                        $.post("<?php echo $ordering_url?>", order, function(theResponse){});
                }
            });
 
Is there an easy way to call this when the image has finished uploading, rather than when the images have been ordered?  I've tried attaching the following code to the onComplete callback of the createUploader but to no avail. Any help would be greatly appreciated!  Thanks
 
var order = $(".photos-crud").sortable("serialize");
                $.post("<?php echo $ordering_url?>", order, function(theResponse){});