Note that there are some explanatory texts on larger screens.

plurals
  1. POFor a Google Wave Gadget, is there a defined point at which it's ok to modify UI?
    primarykey
    data
    text
    <p>I'd like my gadget to have two different views: One when it's just been added, to let the user enter some information, and, once he's done with that, another which displays some data based on that information.</p> <p>The earliest point at which I can decide which of those two views I have to display is when I get the state for the first time, i.e. in the state callback. When I change the UI there, however, it does not always show - apparently there are some timing issues involved. Sometimes the UI doesn't show up at all, sometimes it shows up ok, sometimes it shows up in front of the Gadget-loading animation.</p> <p>Here's a simple test case:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;Module&gt; &lt;ModulePrefs title="Trivial" height="120"&gt; &lt;Require feature="wave" /&gt; &lt;/ModulePrefs&gt; &lt;Content type="html"&gt; &lt;![CDATA[ &lt;script type="text/javascript"&gt; function createForm () { document.write("&lt;div id=\"form\"&gt;"); document.write("Username: &lt;input type=text value=\"whatever\" id=\"user_name\"&gt;"); document.write("&lt;input type=button value=\"Go!\" onClick=\"fetchFromUsername()\"&gt;&lt;br&gt;"); document.write("NSID: &lt;input type=text value=\"287312604@N00\" id=\"user_id\"&gt;"); document.write("&lt;input type=button value=\"Go!\" onClick=\"fetchFromNSID()\"&gt;&lt;br&gt;"); document.write("Number of photos: &lt;input type=text value=\"3\" id=\"per_page\"&gt;"); document.write("&lt;/div&gt;"); } &lt;/script&gt; &lt;script type="text/javascript"&gt; function stateUpdated () { createForm (); } function init() { if (wave &amp;&amp; wave.isInWaveContainer()) { wave.setStateCallback (stateUpdated); } } gadgets.util.registerOnLoadHandler(init); &lt;/script&gt; ]]&gt; &lt;/Content&gt; &lt;/Module&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload