touch-dnd icon indicating copy to clipboard operation
touch-dnd copied to clipboard

I need to stop draggable, and re-start again after DOM modifications! Is it possible?

Open wuilliam321 opened this issue 5 years ago • 0 comments

Now i can, but, if i do stopDragging and startDragging again, the events is called n times as stop/start methods are called i mean. There are no way to unsubscribe the previously registered events. IE: droppable:drop

  startTeamDraggable() {
    $('.m-tagStructure-team')
      .draggable({
        connectWith: '.m-tagStructure--folderOfFiles > .m-flexTable-row > .m-tagStructure-folderTitle, .m-tagStructure--folderOfAnything > .m-flexTable-row > .m-tagStructure-folderTitle, .m-tagStructure-managingTeamArea',
        handle: '.m-tagStructure-dragHandle'
      })
      .on('draggable:start', this.startDragging.bind(this))
      .on('draggable:stop', this.stopDragging.bind(this));
  },
stopTeamDraggable() {
    $('.m-tagStructure-team').draggable('destroy')
      .off('draggable:start', this.startDragging.bind(this))
      .off('draggable:stop', this.stopDragging.bind(this));
}

if i run this methods 3 times, so when draggable:start event occurs, it run 3 times the this.startDraggnig method! How can i correctly do an off call to unsubscribe the events?

wuilliam321 avatar Jul 09 '18 20:07 wuilliam321