views:

258

answers:

2

I'm learning Google Wave gadgets.

I'm trying to force my gadget to resize itself.

But I'm keep getting error that gadgets.window is undefined.

Here is my gadget:

<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs title="GitHub Gist Gadget">
  <Require feature="wave" /> 
  <!--Require feature="locked-domain" /-->
  <Require feature="dynamic-heights" />
</ModulePrefs>
<Content type="html">
<![CDATA[ 
<div id="content_div"> 

<input type=button onclick="gadgets.window.adjustHeight()" />

<script src="http://gist.github.com/244697.js"&gt;&lt;/script&gt;

<script type="text/javascript">
  gadgets.window.adjustHeight()
</script>

</div>
  ]]> 
  </Content>
</Module>

BTW, if you know about gadget to embed GitHub gists into Google Waves, please tell me. :-)

+2  A: 

replace dynamic-heights with dynamic-height.

gadgets.window.adjustHeight() should be replaced with gadgets.util.registerOnLoadHandler(gadgets.window.adjustHeight), becouse gadgets.window may be not loaded while you initialize gadget.

ghisguth
+1  A: 

For the same problem but with igoogle gadget design.

i found out that the gadgets.window object was only available in the sandbox, but you can use the igoogle function:

_IG_AdjustIFrameHeight();

that will automatically adjust the iframe, igoogle. ;)

source: http://code.google.com/p/opensocial-resources/issues/detail?id=572

Coombesy