desandro / masonry

:love_hotel: Cascading grid layout plugin
https://masonry.desandro.com
16.39k stars 2.11k forks source link

Remove item on server #1018

Closed federicovilla closed 6 years ago

federicovilla commented 6 years ago

First of all thanks for the great plugin. I'm wondering, removing a Masonry Item, if I could send some data ( an id, for example ) to a server. In my project I need to show images on Masonry allowing user to delete each image from Masonry and from the server. Thanks a lot and sorry for silly question...I'm learning Test case: https://codepen.io/Vespa/pen/bYXzZq

desandro commented 6 years ago

Were you able to resolve this issue?

federicovilla commented 6 years ago

Hi desandro...negative so far. I'm not able to send an id data or whatever to the server when I remove an item from the masonry gallery :( Still fighting with this issue....any hint appreciated.

desandro commented 6 years ago

I recommend approaching this issue by first removing Masonry. How would you add/remove the item without Masonry? If you can get that working, you may be better able to understand how to add Masonry back in.

federicovilla commented 6 years ago

Hi desandro, thanks a lot for your efforts and time. About removing the item without Masonry: we are talking about image files...each file could be uploaded intoa server and the related data ( filename ) are stored into a database, each filename gets its own id into the DB table. Right now the user page shows a table ( AJAX based ), each row has its ID data; removing a table row using jQuery I can read the related ID and send a call to the server where a PHP script remove file from filesystem and delete database data. I don't understand if I can attach an ID data to each Masonry element and how can I send this data to the server. Sorry for my poor english and hope I explained my issue.

desandro commented 6 years ago

Given your description (adding and removing items with AJAX and IDs), I recommend you try creating this behavior without Masonry. Then after you have that working, go back and add Masonry back in.