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

Dynamic space filling? #92

Open IS0metric opened 8 years ago

IS0metric commented 8 years ago

Hello all,

Very nice project you have here. I have an issue where I have created my own set of 'fixtures' like the ones you used in the demo, and have generated my 'items' from them. I have then written some code which should place them dynamically on the grid without overlapping with any other cells or the edge of the grid.

I am using the 'vertical' format of the grid list.

It's almost there I think, but there is an issue with not filling up all the white space. It is easier to explain with a diagram:

WHAT I GET:                    WHAT I WANT:
+----------+ +----------+      +----------+ +----------+
|          | |          |      |          | |          |
|          | |          |      |          | |          |
|          | |          |      |          | |          |
+----------+ |          |      +----------+ |          |
             |          |      +----------+ |          |
             |          |      |          | |          |
             |          |      |          | |          |
             |          |      |          | |          |
             +----------+      +----------+ +----------+
+----------+
|          |
|          |
|          |
+----------+

My function detects the maximum height of a row and if the row is filled or not - if it is filled, the next row starts below the very bottom of the previous one, regardless of whether or not we can fit it into the previous row.

Is there anything built into GridList that will automatically detect that space and fill it, or will I have to figure it out with my item generator? Thanks!