I tried to reproduce it using the code you provided, and everything worked fine. Can you provide a complete (yet as simple as possible) example (HTML file) that demonstrates the problem?
On Fri, Jan 14, 2011 at 6:41 PM, Peppi <[email protected]> wrote: > Hi, > > I am reading data from a Google Spreadsheet using the Visualization > API. If I add data to a new column, then delete that data, everything > works fine - the new data will show, then on the next refresh it will > go away since it's been deleted. But on the next refresh (currently > set to 1 minute), the deleted data is being returned again! The > spreadsheet has not been changed. Here is the relevant code. Does > anybody know what's going on? > > var url = null; > var refreshInterval = null; > var callback = null; > var isVisualizationLoaded = false; > var query = null; > var heartbeatTimerId = 0; > > function getData(url, refreshInterval, callbackn) { > this.url = url; > this.refreshInterval = refreshInterval; > this.callback = callback; > > //For some reason, trying to load the Visualization API more than > once does not execute the callback function. > if (!isVisualizationLoaded) { > loadVisualizationAPI(); > } > else { > sendQuery(); > } > } > > function loadVisualizationAPI() { > isVisualizationLoaded = true; > google.load("visualization", "1", {"callback" : sendQuery}); > } > > /** > * Create a query , then send it to the spreadsheet data source. > * Also give the name of a function ("handleQueryResponse") to > * run once the spreadsheet data is retrieved. > */ > function sendQuery() { > if (query !== null) { > query.abort(); //Stop the automated query sending set by > Refresh Interval. > } > > query = new google.visualization.Query(url); > query.setRefreshInterval(refreshInterval); > query.send(processResponse); > } > > function processResponse(response) { > var data, text, json; > > restartHeartbeatTimer(); > > //Get spreadsheet data. > data = response.getDataTable(); > text = data.toJSON(); > json = JSON.parse(text); > > //Call the callback function. > callback(json); > } > > /** > * Monitor Visualization API refresh updates with Heartbeat Timer. > * This is a work around for Visualization API bug when it stops > * refreshing data if data hadn't change for 2 consequent data > requests. > */ > function restartHeartbeatTimer() { > clearTimeout(heartbeatTimerId); > var interval = 0; > > try > { > //Set Heartbeat Timer to 3x times longer then refresh > interval. > var interval = 3 * 1000 * refreshInterval; > } > catch(err) > {} > if (interval > 0) { > heartbeatTimerId = setTimeout('sendQuery()', interval); > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-visualization-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" 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-visualization-api?hl=en.
