PDA

View Full Version : Grid shrinkwrap (shrink to fit content)



kerum
14 Dec 2013, 3:29 AM
Hello,

I've to place a ExtJS grid in an existing HTML page. The grid and it's columns are dynamically generated and the exact width is unknown. Is there a possibility to config grid such way, that it occupies as less space as possible (shrinks to fit own content)? I've tried to set different layout managers for a grid or place it in a wrapper like table or div with style display inline-block but without effect.

What is the best approach for it?

Kevin Jackson
17 Dec 2013, 5:49 AM
Have you tried creating it in a container set to fit for layout? Are you setting any dimensions for columns or the grid itself?

kerum
17 Dec 2013, 1:15 PM
Thank you very much for your interest.
I've read, that grid is a panel so I've tried to play with the grid options like 'layout' but without success.
I haven't tried to place grid in other container, which one could limit the width of the grid?
Besides I've tested the various combinations of width (grid/columns), forceFit (grid), flex (columns)
but I haven't managed to shrink grid to the content. The autoSize() method of column is promising (I haven't tested) because I think it can shrink only columns not the whole grid, please correct me if I'm wrong.