PDA

View Full Version : XTemplate and Size question



ChiefDanGeorge
3 Jan 2012, 9:11 AM
I'm using an XTemplate in a panel to display a search query. The panel has an initial height assigned to it, however I'd like to resize it if the data going into the XTemplate requires this. When I call getHeight()
on the panel with the XTemplate, I just get back whatever the config height is. Is there a call to get the height of the XTemplate after overwrite is called?

Thanks!

Dan

mitchellsimoens
3 Jan 2012, 9:53 AM
After you execute the update method on the panel, you can try to get the height of the element that the template was applied to. To get that element you can do this:


panel.getTargetEl()

If that panel is not within a layout that manages it's size (vbox, fit, card) then it should auto height if you specify no height.

ChiefDanGeorge
3 Jan 2012, 10:50 AM
The panel is a tab in a tabpanel. I've tried called the getTargetEl() and the getHeight(), however the height seems to be the height of the tabPanel. I can resize the parent if needed, but I need to know what to resize it to.

Dan

I set the height to 'auto' and after

After you execute the update method on the panel, you can try to get the height of the element that the template was applied to. To get that element you can do this:


panel.getTargetEl()

If that panel is not within a layout that manages it's size (vbox, fit, card) then it should auto height if you specify no height.

mitchellsimoens
3 Jan 2012, 10:59 AM
TabPanel uses card layout which is very much like fit layout so the height is managed. You can nest a component in there to do the auto height

ChiefDanGeorge
3 Jan 2012, 11:04 AM
Nest a component in where, the TabPanel? Or do you mean create a new Panel to add?


TabPanel uses card layout which is very much like fit layout so the height is managed. You can nest a component in there to do the auto height

mitchellsimoens
3 Jan 2012, 11:06 AM
A component can have a tpl and then use the update to apply the data to the tpl.

ChiefDanGeorge
3 Jan 2012, 11:38 AM
That's the way the panel is setup.
I think the issue is the panel height is constrained by the parent. So if the parent height is 500 and my panel needs to be 600, when I call panel.update(jsonData) it is render and the height is constrained to 500.

I appreciate the feedback!


A component can have a tpl and then use the update to apply the data to the tpl.

ChiefDanGeorge
3 Jan 2012, 12:25 PM
Ok, think I've got it worked out.
On the TabPanel, I set a minHeight value.
On the Panel where I want the results, I also set a minHeight.
This allows the results Panel to resize to anything bigger than the 500.

One thing I noticed is if height: 'auto' is also set, it won't work properly.