dsmorse / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://dsmorse.github.io/gridster.js/
MIT License
793 stars 194 forks source link

BUG: Destroy() and re-intialize fails to allow draggable #148

Open timothymarois opened 4 years ago

timothymarois commented 4 years ago

The destroy method seems to work, bu when you try to add gridster back on, draggable elements are no longer functional, the grid resizes and aligns the widgets correctly, but they're no longer draggable.

The issue I came across is reactive data, so destroying when data is updated and rebuilding gridster with updated reactive data on the HTML end, was the plan, but looks like you can not add gridster back after destroying.

The console has no errors, something else has cut off from running.

Add widgets by HTML is ok, but being able to add widgets by outside source, where you can have gridster.refresh() would be really ideal for reactive data.

timothymarois commented 4 years ago

Commenting this out in the gidster.js file on destroy()

if (this.drag_api) {
    this.drag_api.destroy();
}

Now dragging works when re-initializing. Though without further details, not sure whats going on with that if it will just leak memory over time. Looks like destroy does some damage to the drag API

lwdsw commented 1 week ago

Hello, sir. This is invalid for me. Have you solved it now? I think I have no patience to debug this problem anymore. I'm about to give up. LOL~