-
-
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
Fixed grid-size inside dynamic width/height (flexbox) #728
Comments
Manage to solve this by calculating the cellHeight when the grid is initilized, and then use the same method to recalculate the cellHeight when my grid "wrapper" changed height. The only problem now is that IF a widget is for example 12 out of 12 cells in height, it will not resize when the grid does, it get stuck in the bottom of the grid and it's not updating the height. This might be some sort of bug but I don't know? For all of you who wants to calculate the height can use this function!
And use this for the resize event!
|
You should probably throttle or at least debounce the resize event to prevent it from firing too many times causing the app to become unresponsive; the resize event can easily fire hundreds of times on a single resize action. Based on yours, I'm using a very similar approach in my React component (simplified for clarity) with the extra throttling:
I found using lodash much easier and faster than implementing my own logic, but it's not very complicated if you'd want to. |
@demedos Good thinking! But I don't feel like using lodash in my Angular IO (4) application, and I am already using Rxjs Observables. So with your comment in mind, I tweaked my solution to debounce the amount of event. Here is my code reworked with Rxjs!
Thank you for pointing it out to me, I totally forgot about it! :) |
So does anyone have anything new about this? The main problem is still how to calculate a fixed grid-item height with a |
@adumesny Aren't you doing something similar with the height? I assume the x problem is easy because the grid already isn't changing number of columns, only rows. |
@radiolips Okey so here is a full explanation of what I am trying to do... I want to be able to change the amount of columns and rows of my gridstack area from (lets say two simple inputs). As an example I will start of with a 12x12 grid. Then I am generating a stylesheet with the right amount of column.
Then listen for a window resize and recalculate the cellHeight from the new container with, but here is where I want to have a The function I am using right now looks something like this:
|
@radiolips thanks, yes this is very similar to what I'm trying to do in #787 - other than my grid being nested inside another grid-item, but I also want it to take 100% height and adjust I really like the idea of having a |
Hi!
I have been looking all over the place for a solution to this problem, but I just can´t seem to find it.
Is is possible to generate a grid-stack area with given x and y columns inside a fluid width/height flexbox div? So when the window resizes the grid changes width and height but keeps the same amount of x and y columns. From my experience I can only get the width to become fluid, but the height keeps on growing when i drop an item below the current grid height.
I have looked at this one #118 and this one #404 but it´s not quite right.
Thanks for an awesome library.
Feel free to ask me if you need any more information.
The text was updated successfully, but these errors were encountered: