Empty grid default height
Hi,
Is there an option to set the minHeight for the grid? In this way for example, when it's empty, I'll still be able to drop element on it.
Even in your dual grid example (http://troolee.github.io/gridstack.js/demo/two.html) if I move all elements from the left grid to the right one I'll not be able to drop elements on the left grid anymore.
I mean, you could always set "min-height" to the grid element but maybe an option in the component could be useful :)
Hi, you can setup min height for the grid in css:
.grid-stack { min-height: 300px; }
Setting the min-height for the grid seems to screw up the drag position calculations. For example, items have to be dragged further down before the item changes position. Is there a way to set min--height on the grid without this happening?
@troolee Setting min-height does seem to make the resizing of elements act weird as @kurigohan mentioned. (As a workaround I’m adding a ‘ghost’ element to the grid if it is empty).
Why is this issue closed? setting min-height via css broke grid usage and there is no option for min height
+1 - It would be nice if the grid can be instantiated without elements. I use the gridstack.js for creating a form. The user can drop new elements into the canvas.
I am using the draggable event of the elements outside the grid to add a min-height to the .grid-stack class on drag-start.
On stop, I remove the class to not break the grid itself.
+1 @barryceelen for his workaround.
I used a "ghost" element as suggested have this this issue solved.
I set it height to the maximum height of the grid element then I set the content backgroud-color to be transparent, no moved and locked then I push it to the right left.
Code of my ghost element
<div class="grid-stack-item" data-gs-locked="true"
data-gs-x="12" data-gs-y="0" data-gs-no-move="true"
data-gs-width="1" data-gs-height="6">
<div class="grid-stack-item-content" style="background-color: transparent;"></div>
</div>