calibre-web/cps/static/js/shelforder.js

33 lines
869 B
JavaScript
Raw Normal View History

2017-03-31 16:31:16 +00:00
/* global Sortable,sortTrue */
2017-03-30 19:17:18 +00:00
var sortable = Sortable.create(sortTrue, {
group: "sorting",
sort: true
});
function sendData(path){
var elements;
var counter;
var maxElements;
var tmp=[];
2017-07-18 18:39:35 +00:00
elements=Sortable.utils.find(sortTrue,"div");
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();
}