gridstack / gridstack.js

Build interactive dashboards in minutes.
https://gridstackjs.com
MIT License
6.53k stars 1.27k forks source link

Drop item to remove it #2602

Closed ptorrent closed 7 months ago

ptorrent commented 7 months ago

Hello,

I would like to drop grid item on a trash button to remove it.

Is that possible with the dragstop event ?

grid.on('dragstop', function(e){
e.target == MY BOUTON )  widget remove...
})

the event passed to dragstop callback don't seems to be a native drag & drop event... ?

Even with this, there is no drag & drop event

BUTTON.addEventListener("dragover", (event) => {
    console.error('drago over')
    event.preventDefault();
});
BUTTONaddEventListener("drop", (event) => {
    event.preventDefault();
    console.error('drop')
});

Thanks for your support !

ptorrent commented 7 months ago

OK must use removable grid option !