Deleting a widget (GridsterItem) leaves a gridster-preview behind
See original GitHub issueDescribe the bug
Deleting a widget (GridsterItem):
public onDelete(item) {
this.items.splice(this.items.indexOf(item), 1);
}

Leaves a gridster-preview behind:


Demo
Firebase Hosting: Serendipity
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Gridster remove widget by dragging into div - Stack Overflow
I am using gridster.js and am trying to figure out a good way to set it up where I can drag one of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello, There is already an option to delay the drag. But another simple option is to take the event on the button and call
stopPropagation()And the binding in html is on mousedown instead of click since the drag is bound to mousedown also. You can see that in the demo app I do the same thing here: https://github.com/tiberiuzuld/angular-gridster2/blob/master/src/app/sections/home/home.component.ts#L92Alright, so I’ve figured it out. When I clicked on my custom delete button the mousedown on gridster item was triggered, and thereafter the drag process started. Since on that process, I (and I’m assuming all of you as well) would correctly remove the item from the array of items, gridster didn’t know the process was finished, because it was never “released”.
The solution was pretty simple, I remove my item from within a
settimeout:Now it’s working properly, with no “left over” elements. Though it should be said that fixing this behavior, by maybe adding a delay to start the drag, would be the best solution.