-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
When destroying and recreating a grid that previously had a listener on it, the listener does not appear to be removed. Please see the following example code. The code below is called against an existing grid that needs to be recreated (SPA use-case):
widgetsGrid.destroy(false); widgetsGrid = GridStack.init( { //column: 24, resizable: false, cellHeight: "40px", margin: 10, }, itemDiv); widgetsGrid.on("added", async function (event, items) { console.log("Items: ", items); }
The above "added" event runs twice after the grid is destroyed and recreated with the above code. Shouldn't destroy remove the listeners as well? If not, how do you remove the listeners when destroying the grid?