-
-
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
Creating a fixed width grid based on pixels instead of percentage. #552
Comments
@cblokker Did you ever figure out how to do this? I am also looking at how to implement widths based on pixels and not percentages. My won't even snap to the correct places. It seems to be off by a large margin. |
This is the function that is causing me grief:
In the case of a pixel based width, along with a css that defines the columns in pixels, I need this function to return only this.opts.width. I think we would either need some smarts in gridstack to determine what model it was in (% or px) or have a configuration option to tell it what mode. Edit: It might not be quite as simple as that. I'm playing with it now to see. Edit 2: My 5 minute fix. It doesn't, at least yet, have a responsive flow to it yet. |
Would love this, as there is a problem with viewing grids in 4k screens, sometimes you want the web page to be wide, in which case you have to set up a new grid where the sizes are pretty much halved, and then when you resize the page down to a resolution others will use the widths are too narrow. |
I too would very much like to see this feature being supported by gridstack |
Same here, I would love to see that in grid stack. In the meantime, I was able hack it for my simple use case (one row, disabledOneColumnMode, height=1)
constructor:
Reset the width in the resize handler
the hack is to force the cellWidth to 100px (as set in the CSS) by adjusting the width (column count) based on the current grid width (px). |
You can set |
I'm trying to create a fixed cell width and height independent of window size. I'd like to create a 20px by 20px grid where each widget can fluidly move up and down in 20px increments. I'm able to get the height fixed by passing
cellHeight: 20
, but width doesn't seem to work very well. This is what I'm passing into options:I tried
cellWidth: 20
, but that didn't seem to work. I also modified the scss script to be calculated based on px instead of %.This snaps grid items into the correct 20px grid locations, but horizontal dragging becomes less smooth. Is there something else I need to add to the .scss script so horizontal dragging maps to grid width? Or do I need to do something different for the
width
orcellWidth
param? I'd like to get away from any % calculations :)The text was updated successfully, but these errors were encountered: