Javascript 如何使用sortablejs排序和更新dropzone图像顺序?
我正在使用带有sortablejs的dropzone,但我无法在排序后获得更新的文件数组。分拣工作正常。请告诉我哪里错了。下面是我的代码Javascript 如何使用sortablejs排序和更新dropzone图像顺序?,javascript,dropzone.js,sortablejs,Javascript,Dropzone.js,Sortablejs,我正在使用带有sortablejs的dropzone,但我无法在排序后获得更新的文件数组。分拣工作正常。请告诉我哪里错了。下面是我的代码 var dropzone = new Dropzone('#dropzone', { url: '/canvas/ajax', addRemoveLinks: true, uploadMultiple: true, autoProcessQueue: false, accept
var dropzone = new Dropzone('#dropzone', {
url: '/canvas/ajax',
addRemoveLinks: true,
uploadMultiple: true,
autoProcessQueue: false,
acceptedFiles: ".png,.jpg,.jpeg",
dictRemoveFileConfirmation: 'Do you really want to remove this file?',
init: function() {
load_props()
var newQueue = [];
var submitButton = document.querySelector("#prop_list button")
myDropzone = this;
submitButton.addEventListener("click", function() {
myDropzone.processQueue();
})
this.on("sending", function(file, xhr, formData) {
formData.append('instance_id', '<?php echo $instance_id; ?>') // Passing instance id with the props
});
this.on('removedfile', function(file) {
const id = {
id: file._removeLink.dataset.id
}
});
var el = document.getElementById('dropzone')
var sortable = Sortable.create(el, {
animation: 150,
group: 'props',
cursor: 'move',
sort: true,
draggable: '.dz-preview',
ghostclass: 'ghost',
filter: '.dz-message',
onSort: function(evt) {
}
})
},
});
var-dropzone=新的dropzone(“#dropzone”{
url:“/canvas/ajax”,
addRemoveLinks:是的,
uploadMultiple:true,
自动处理队列:false,
acceptedFiles:“.png、.jpg、.jpeg”,
dictRemoveFileConfirmation:“是否确实要删除此文件?”,
init:function(){
加载道具()
var newQueue=[];
var submitButton=document.querySelector(“属性列表按钮”)
myDropzone=这个;
addEventListener(“单击”,函数(){
myDropzone.processQueue();
})
this.on(“发送”,函数(文件、xhr、formData){
append('instance_id','')//用props传递实例id
});
this.on('removedfile',函数(文件){
常数id={
id:file.\u removeLink.dataset.id
}
});
var el=document.getElementById('dropzone')
var sortable=sortable.create(el{
动画:150,
小组:"道具",,
光标:“移动”,
排序:对,
可拖动:'.dz预览',
鬼类:'鬼',
筛选器:'.dz消息',
onSort:函数(evt){
}
})
},
});
任何解决方案,谢谢