hootsuite / grid

Drag and drop library for two-dimensional, resizable and responsive lists
http://hootsuite.github.io/grid/
Apache License 2.0
3.57k stars 279 forks source link

New items being stack one below previous item #118

Open tonypine opened 6 years ago

tonypine commented 6 years ago

I'm trying to handle add and remove action, the approach that I'm using right is this:

this.addNewItem()
this.$el.gridList({
  direction: 'vertical',
  lanes: 12
})
this.$el.gridList('resize')

In the addNewItem I just append a new element in the DOM to the grid element. Then I reinitialize the grid, and call a resize.

The behavior is awkward, I have to call resize several times to the grid organize itself correctly, that in my mind would be adding new elements from the left to right row by row.

Do someone have any tip on how to get this to work?