-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grid items to take entire parent height (simulate % rows, like columns do) #787
Comments
same/related to #717 #728 #118 #404 and probably many others... would be ideal to have |
@argument Or you could set the height to X amount of rows and then gridstack would use the height of itself or parent to split into X rows. That way it would work the same way as width does now. Then only specify verticalMargin if you want spacing between each row. For auto expanding height behaviour, you could set height to "auto" instead? |
@krilllind if you have fixed # of column (12) and rows then you can't really add/remove content without sizing them down and you still have an absolute max. This and the other request are to have grid fill the available height provided by parent, but still let you interact/add/remove items. |
Have you made any progress on this issue? I have this problem as well as several others. Here's the new issue that i made. # #814 |
Have you planned to release this in a new version soon ? |
@Altraya I have not looked at a fix but would love to have someone submit a code review for this! |
ironically I own the lib now but have not looked at my early request as my needs have changed since then... :) |
@adumesny was this ever completed ? i'm not using nested grids but i've read through all the other issues... I'm trying to achieve can the height of a grid be 100vh and resize the inner items to always stay within that height so the user never has to scroll ? Edit: @adumesny - After Reading other threads it seems that I might be able to hire you to help with this issue? Please let me know. Thank you! |
yes, donation are always welcomed. v6 has been released so I'm available to work on features again... ping me directly |
Hi, how it's going on that issue? Is it possible to have 100vh grid with auto scalable items inside? |
not going to happen (I don't need it for work) unless someone wants to support it... not an easy feature. |
(sub)-grid would look like this (yellow being 'full screen') with each component number representing # of rows (h) as you add/resize items. not matter what you bring in (how tall h) it will eventually scale all to fit into 100vh (or other) grid. so technically row are changing % to the min/max/current always fit 100% of the container |
Hi, As I was trying to achieve the same thing I gave the following a go: In the CSS: .grid-stack {
display: block;
overflow: hidden;
height: 100%;
min-height: 100% !important;
} and in the JS: const N_COLS = 12;
const N_ROWS = 12;
var grid = GridStack.init({
column: N_COLS,
cellHeight: 100 / N_ROWS,
cellHeightUnit: "%",
maxRow: N_ROWS
}); Unless I have missed something, it seems to achieve the desired behaviour with no change to the gridstack code. |
ok good to know. didn't think |
Hi, for the nested grid demo https://gridstackjs.com/demo/nested.html#, may I know which part makes the second nested grid to be taking the full height of its parent? I have followed the code, but on my end, the nested grid still can't take up its parent's full height. My second approach is using addWidget to add sub grid, by that way, the sub grid cannot take up the full height of its parent's, do you have any suggestion on this issue? |
I'm using nested grids to create compound widgets - tight group of widgets, that can be used as opaque widgets inside other grids (moved as a unit, edited separately). As such I need a nested items to take entire space (width AND height) given by the parent gridItem, which will have user resizable heuristics.
Ideally I would have a
grid.cellHeight = 'dynamic'
mean take entire height of the parent, similar to what we have today with columns taking entire width (% based sizing). Adding a new item would temporally create new rows (create scroll V bars as content won't fit) as you drag/position things around, but then size to fit as you release (shrink the cellHeight to fit, keeping same rows# and overall layout)for now I'm trying to hack in on the side.... not working the simplest part yet!
Your environment
v 0.3.0 and latest 1.0.0-dev showing slightly different behavior (due to
Steps to reproduce
is a copy of demo/nested.html with additional code to handle item resize
$('#grid').on('gsresizestop')
Expected behaviour
nested grid to take entire height of parent (dynamically changing)
Actual behaviour
in v0.3.0 (gridster sample) the grid DOES grow and take entire height, forcing cells to get taller as well, BUT all the siblings gridItems also grow (making me thing either it's an incorrect shared resource or the $() search is not filtered to children of nested grid.
in 1.0.0-dev (the one I use) noting seems to appears as GridStack.prototype._updateStyles() returns early due to this line of code that was moved ealier
if (this._styles._max !== 0 && maxHeight <= this._styles._max) { return; } // Keep this._styles._max increasing
see a38d78e which I don't understand. #766 as well
The text was updated successfully, but these errors were encountered: