-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Problems with dynamically sized containers #2652
Comments
@Dev63 I'm not sure if this helps you or not, but this is what I ended up doing: I wrapped the grid with a div and added my directive called element-size-monitor:
Here is the directive:
Then in the controller just add a watch:
@PaulL1 Would a solution similar to this add any value to the project? It has the benefit of not always having to do a check with a timer. |
@c0bra: do you have a view on this option v's auto resize? I haven't looked at it in detail, but it looks like we'd be trading off a watch for a timer. |
@smithscripts I think I understand how your code resizes the grid when its container resizes, but my problem is that when I try to set the grid's container to take up 100% of the "remaining" height on the page, the grid starts to have problems because of the container type (flexbox or display:table). On the plus side, if you do use flexbox or display:table, the grid automatically resizes with no extra work needed ( If you are not using either of those container types, how are you calculating what the height of the container should be? |
The same issue seems to appear if look at the Demo. If you resize your window the layout breaks temporarily. |
I'm having similar problems. What is basically needed is a way to make the grid "responsive". Are you guys considering implementing this kind of feature at all? If so, would it be included for 3.0 or a future version? I'm aware this is probably a very complex issue to solve. I haven't actually seen other responsive grid implementations myself with the scope ui-grid has. What are your thoughts on this? Btw, thank you very much for the awesome work you all have put into this project! It's really impressive! |
There is another issue with a similar concern out there, and it has a bit more information. Basically it's to do with the order of rendering, we're noticing the resize and updating the grid width, but then IIRC it takes a digest cycle before the renderContainers settle down, and during that time you get a flicker. I'm pretty sure that it's possible to fix it, but the right answer (to me at least) is to change the way we're doing resizing so it's not so iterative. This would also fix (for me at least) a few things in the header heights. Although I have a feeling @c0bra already fixed that when we did the dynamic filter thing. I think making it less iterative would mean some sort of promise architecture so that we could flag all the things we were planning to recalculate and then do it all in one go at the end - although even that sort of implies a timeout or a digest cycle. It's a bit annoying to work with because it's a flicker on resize, so it's really hard to get a debug on it...clicking off the window (into the debugger) makes it stop happening I think. I tried for a while and then failed. |
I think this is another flavour of #3031, noting that to link them together. |
Someone privately messaged me, asking for advice on how to get the grid to work in an expanding view (as described above). Basically, you do something like this in your main page:
Then in your view file, you label all top-level divs as
Now your grid will automatically expand or shrink to fit all remaining non-fixed space. The key is that you have to start with the flex at the body level, and follow it all the way down to the grid. This works reasonably well with a December 2014 version of ui-grid (automatically resizes with the window), but I haven't been testing it against later releases. |
Sorry for taking so long to reply. I have put directions in the original On Wed, May 6, 2015 at 7:24 AM, Gargaroz [email protected] wrote:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. If you believe that this is still an issue in the latest version, feel free to re-open it. Thank you for your contributions. |
I love ui-grid (thank you!!), but it does not behave well in dynamically sized containers, either via flexbox or display:table.
Goal: The goal is to have my grid grow to fill the available space between a dynamic header and footer, which makes sense on certain pages because the page is primarily all about a single table, and it's a nice UI experience to use to have the grid expand to the dimensions the user can/wants to display. Setting a fixed height for the grid leads to an awful user experience in which the user sometimes has to scroll both the page and the table (or the table is very small and the user is frustrated by being unable to use his monitor fully). Note the header itself may dynamically change height depending on the browser window width, as things start to wrap.
Problems with
display:table
: There have been a few problems with using the grid in a flexbox, some documented elsewhere, so I decided to try to redo the whole site to usedisplay:table
instead. Unfortunately, take a look at this simple plunker. In Chrome on Windows:ui-grid-selection
. Widen the display portion of the plunker with your mouse, and it will now display correctly. Now try to narrow the display portion and watch all hell break loose.ui-grid-selection
, things are better, but when you try to narrow the display, the grid refuses to shrink. Addingui-grid-auto-resize
changes nothing.Surprisingly, flexbox seems to do better than display:table, but both have serious problems. Putting the grid in a standard div with height:100% and width:100% works nicely, but this is impractical for all the standard CSS reasons, unless you want nothing else on the page.
The text was updated successfully, but these errors were encountered: