vpusher / the-grid

Grid layout custom element with drag and drop capabilities
https://www.webcomponents.org/element/vpusher/the-grid
MIT License
129 stars 32 forks source link

dynamically add a tile #20

Closed vortex314 closed 7 years ago

vortex314 commented 7 years ago

Great tool to create dashboards ! I was wondering if it is possible to dynamically add tiles. I tried with jQuery : clicker = function () { $("#thegrid").append('<div class="tile" col="3" row="3" height="1" width="1"><span resize="top-right">┐</span></div>'); }; This creates an additional tile but it's not draggable or resizable. Maybe my understanding of webcomponents is too limited to make this work. Advice is welcome.

vpusher commented 7 years ago

Indeed, this is currently not supported. Actually, the only missing thing is adding the drag handlers so you can move and resize the tiles. I need to implement it either using a dedicated method on the component itself like a #addTile(element), or using MutationObserver on the sub tree. The last one beeing the proper way. In the meantime, feel free to PR ;)

vpusher commented 7 years ago

@vortex314 Delivered in v1.4.0