Dynamically resizing mashlets

michael.rollins's picture
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 01/07/2009
Points: 231
Groups: None

Is there a way to dynamically resize a mashlet so that it fits the screen or div that it's in?

0
Your rating: None
User offline. Last seen 1 week 6 days ago. Offline
Joined: 09/22/2008
Points: 54
Groups: None

Pass "auto" for height and width. Add "&width=auto&height=auto" to your Mashlet Script tag.

michael.rollins's picture
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 01/07/2009
Points: 231
Groups: None

Thanks, Kishore!

michael.rollins's picture
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 01/07/2009
Points: 231
Groups: None

Kishore,

width=auto works fine, but height=auto does not.  It will open it to about 400 pixels high but will not create a height of more than that no matter where I open it.

I'm using Firefox 3.

User offline. Last seen 1 week 6 days ago. Offline
Joined: 09/22/2008
Points: 54
Groups: None

Can you try height: "100%" ?

michael.rollins's picture
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 01/07/2009
Points: 231
Groups: None

No dice, dude.

It ignores "&height=100%" and I can't put 100% in the properties for the mashlet.

User offline. Last seen 1 week 6 days ago. Offline
Joined: 09/22/2008
Points: 54
Groups: None

Michael,

Does the parent DIV have a height set? Or is that floating as well? For "auto" or "100%" to work, the parent div must have a fixed height. This is not a limitation of Mashlets but how the browser renders the html.

Can you paste the html fragment here ?

Kishore

michael.rollins's picture
User offline. Last seen 13 weeks 5 days ago. Offline
Joined: 01/07/2009
Points: 231
Groups: None

The answer to that question is very complicated.  Keep in mind that auto width works in this scheme.

We have one page per mashlet where all we do is run the script block.  We iframe that window into an ext card layout inside of a border layout.  That page is in turn iframed into the Ext web desktop as an "application".  So, eventually, there is a size set on the div, I just have no idea what that size might be or if it is, indeed floating.

jeremy.pitten's picture
User offline. Last seen 1 week 17 hours ago. Offline
Joined: 09/22/2008
Points: 275
Groups: None

I think you'll need to solve this problem within your mashlet implemention, the mashlet base class, Ema.BoxMashlet, doesn't listen for resizing of its container. If you take a look at mashboard, where it does appear that mashlets are being dynamically resized, they are actually being reloaded so that the mashlet dimensions are reset on loading. This will not be the case in future releases where we intend to make mashlets resizable once rendered.

So from within your mashlet implementation I would suggest your mashlet listen for resizing events on the element containing the mashlet and to then update your mashlet display when a change in size is detected.

Also, I'm not sure about the cascading of resize events from your desktop window, through to the iframes and down into your page containing the mashlet, there may be problems here.