PDA

View Full Version : Can gridpanels grow dynamically?



newedge
17 May 2009, 8:44 PM
I have searched looking for a way to get my grid tables to grow based based on much content is bound to it with no luck.

I have tried setting the height to auto with no luck. If I remove the height then I get a table that is about the size of one row. Is it because I'm retrieving the data asynchronously? If so is there something I can call after the grid is populated?

I appreciate the assistance and hope that others can benefit from the response as this is probably what most people prefer when integrating these grids in a website and not a windows "type" based app.

Thanks again

MD
17 May 2009, 11:37 PM
Hi newedge,

You can achieve that fairly easily by including you own .css and adding a cls: 'blahmyclass' to the GridPanel's (or a parent container's) config. Through inheritance, you can override the 'height' and 'overflow' css properties on a few specific elements within the GridPanel/GridView. If necessary, force override with !important (ie. height: auto !important; ).

I was able to do that just now on the grid examples page (http://extjs.com/deploy/ext-3.0-rc1.1/examples/grid/grid3.html), under the HTML/Style tabs in Firebug by altering the following nodes on any one of those grids:

x-panel-body -> change height to auto
x-grid3 -> change height to auto
x-grid3-viewport -> change overflow to visible
x-grid3-scroller -> change height to auto, overflow to visible

Alternatively, instead of doing it with CSS, you could extend GridPanel and alter it so as to have it not apply fixed heights/overflow on those nodes.

MD

newedge
18 May 2009, 4:57 AM
Thank you very much. Yes this has far more of a natural look when embedded into websites. Not sure why I didn't see this request come around more often. You would think the design (graphic artist) in the group would request this as the default behavior.

Or they just knew how to make the change without asking :-)

Thanks again

newedge
18 May 2009, 12:59 PM
Thank you so much... that did the trick after a couple of !important additions. These tables now can now really work like I want them :)

MD
18 May 2009, 1:26 PM
You're welcome -- glad it worked out for you. Yeah, there's a few widgets that seem to be constructed/defaulted to work primarily in a viewport layout, as opposed to being in the regular flow of a scrolling page. That can usually be gotten around though.

MD