2017-03-31 09:31:16 -07:00
|
|
|
/* global Sortable,sortTrue */
|
|
|
|
|
2017-03-30 12:17:18 -07:00
|
|
|
var sortable = Sortable.create(sortTrue, {
|
2017-02-07 11:14:43 -08:00
|
|
|
group: "sorting",
|
|
|
|
sort: true
|
|
|
|
});
|
|
|
|
|
|
|
|
function sendData(path){
|
|
|
|
var elements;
|
|
|
|
var counter;
|
|
|
|
var maxElements;
|
|
|
|
var tmp=[];
|
|
|
|
|
2017-03-30 12:17:18 -07:00
|
|
|
elements=sortable.utils.find(sortTrue,"div");
|
2017-02-07 11:14:43 -08:00
|
|
|
maxElements=elements.length;
|
|
|
|
|
|
|
|
var form = document.createElement("form");
|
|
|
|
form.setAttribute("method", "post");
|
|
|
|
form.setAttribute("action", path);
|
|
|
|
|
|
|
|
|
|
|
|
for(counter=0;counter<maxElements;counter++){
|
|
|
|
tmp[counter]=elements[counter].getAttribute("id");
|
|
|
|
var hiddenField = document.createElement("input");
|
|
|
|
hiddenField.setAttribute("type", "hidden");
|
|
|
|
hiddenField.setAttribute("name", elements[counter].getAttribute("id"));
|
|
|
|
hiddenField.setAttribute("value", counter+1);
|
|
|
|
form.appendChild(hiddenField);
|
|
|
|
}
|
|
|
|
document.body.appendChild(form);
|
|
|
|
form.submit();
|
|
|
|
}
|