dimanche 29 mai 2016

(Drag n drop) Dragula.js not working on revisiting the route (in ember.js app)

I am using dragula.js library in an ember.js web app.

Things are working fine (able to drag and drop things) until I revisit the route, after which drag and drop just stops working, that is, can't drag anything that was previously draggable. And there are no js errors in console. Then, I refresh the page (from any route), it works again.

In short, the drag n drop works only for the first time when the route is visited/loaded.

Things I tried:

  • Verified if the DOM items to be drag n dropped, are added to dragula's config.containers.
  • Tried Rerendering the component from didInsertElement element inside the run loop running in afterRender.

didInsertElement(){ this._super(...arguments); Ember.run.scheduleOnce('afterRender', this, () => { let drake = window.dragula(this.getDraggableContainers(), this.get('dragulaConfig')); this.set("drake", drake); }

To me, it seems like the dragula library is initialized with all the required config, but I am baffled why its NOT working correctly after revisiting the route.

Any help/pointers would be greatly appreciated. Thanks!




Aucun commentaire:

Enregistrer un commentaire