I am trying to create a List re-ordering functionality by dragging list items around. It works perfectly. I disable list scrolling on dragstart event and enable scrolling on dragend event.
However, the problem comes while there is more items in a list and it requires scrolling. While I scroll down to say 20th Item, while starting dragging again the list scrolls to top. I am not refreshing list anywhere and found out the issue is mostly coming for setScrollable(false) function. Here is my dragstart code:
Code:
onDragStart : function(draggable, e, offsetX, offsetY){
this.deselectAll();
this.setScrollable(false); // This line causes list scroll to top every time
this.dragEl = draggable.getElement();
this.calculateBoxes();
draggable.getElement().toMoveIndex = draggable.getElement().index;
}
I have to stop scrolling at dragstart event anyway to drag items properly. Any idea how to prevent list scroll-to-top function?
Here is how the functionality looks. I have also attached source code for all the necessary files. You can test yourself and provide suggestions.
list-drag.png