...
|
...
|
@@ -21,23 +21,36 @@ var jQuery = require('jquery'); |
|
|
console.log(dataArray);
|
|
|
for(var i=0; i<items.length; i++){
|
|
|
$(items[i]).attr("drag-index", i);
|
|
|
items[i]._index = i;
|
|
|
}
|
|
|
|
|
|
var placeholder = $('<' + items[0].tagName + ' class="sortable-placeholder">');
|
|
|
placeholder.css("border","2px dashed red");
|
|
|
|
|
|
var handle = options.handle, isHandle;
|
|
|
items.find(handle).mousedown(function() {
|
|
|
isHandle = true;
|
|
|
}).mouseup(function() {
|
|
|
isHandle = false;
|
|
|
});
|
|
|
|
|
|
var isInput = false;
|
|
|
items.find("input").mousedown(function(){
|
|
|
isInput = true
|
|
|
}).mouseup(function() {
|
|
|
isInput = false;
|
|
|
});
|
|
|
|
|
|
$(this).data('items', options.items)
|
|
|
placeholders = placeholders.add(placeholder);
|
|
|
if (connectWith) {
|
|
|
$(connectWith).add(this).data('connectWith', connectWith);
|
|
|
}
|
|
|
items.attr('draggable', 'true').bind('dragstart.h5s', function(e) {
|
|
|
if (handle && !isHandle) {
|
|
|
if(handle && !isHandle) {
|
|
|
return false;
|
|
|
}
|
|
|
if(isInput){
|
|
|
return false;
|
|
|
}
|
|
|
isHandle = false;
|
...
|
...
|
@@ -56,7 +69,7 @@ var jQuery = require('jquery'); |
|
|
var Array = [], sortArray = [];
|
|
|
var itemsUpdate = _self.children(options.items);
|
|
|
for(var i=0; i<itemsUpdate.length; i++){
|
|
|
Array.push($(itemsUpdate[i]).attr("drag-index"));
|
|
|
Array.push(itemsUpdate[i]._index);
|
|
|
}
|
|
|
for(var i=0; i<Array.length; i++){
|
|
|
sortArray.push(dataArray[Array[i]]);
|
...
|
...
|
|