Hello, I have a question regarding the option to save the state of a gadget.
I'm currently working on a gadget which uses the visualization API to retrieve data from a Google Docs spreadseet. The gadget uses a cookie for storing settings which are created dynamically by the gadget. An example for one of these settings would be the number of the data column from the spreasheet data which should be displayed. Due to the fact that the gadget is not able to know how many data columns the recieved data will contain, it is not possible to store this setting in a UserPref inside of the gadget's XML file. That's why this setting is stored as a cookie. Currently there is a UserPref setting that determines the id of the used cookie: <UserPref name="cookie_id" display_name="Cookie ID:" datatype="String" default_value="default" required="true"/> In this way a user is able to enter a unique string in case if he/she wants to insert more than one gadget inside of a spreadsheet. As long as the id is different a new cookie is created for every inserted gadget. This solution works quite well, but it's not user friendly at all. That's why I tried to automate this procedure by creating a random number and using it as a cookie id. I read in [1] about the feature to save the state of a gadget by using the JavaScript function set() combined with a hidden UserPref. I wasn't able to get it to work properly. Every time when the page is refreshed the UserPref setting is set back to the default value. This behaviour results in creating a new cookie every time the gadget is loaded. And that's not good. In [2] I read that when gadgets are installed on a third party they cannot save a state, but when they are installed on iGoogle they can. Finally my question: Can I rely on the information that when the gadget is published to Google Spreadsheets as an environment the saving of a state will work, or should I migrate back to my first solution? [1] http://code.google.com/intl/de-DE/apis/gadgets/docs/fundamentals.html#SetPrefs [2] http://groups.google.com/group/Google-Gadgets-API/browse_thread/thread/b12916b0a549fe09/f374e2191f7295fa?lnk=gst&q=save+state# -- You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en.
