Jon, the Google Groups spam filter decided to not auto-post one of your messages that I just pushed through. No idea why, but I am happier dealing with false positives than false negatives.
On Sat, Apr 19, 2014 at 12:44 PM, jon_pdx <[email protected]> wrote: > Hello again, > > Here's what I've found so far. The functional scope and the interaction > are with caja seem to be fine. I've been able to use innerHTML to log some > comments. > > My issue seems to be that sometimes the objects don't load. When they load > everything seems fine. This is the error that I usually see: *TypeError > guestNode is null*. In my code, I've put in comments with the error codes > that I see. So, if I get the guestNode is null error, then nothing seems to > work. > > I found that I can either load a whole webpage, or just put everything in > one div element. the best practices recommend splitting the various parts > out, but that seems to me to be more orientated for the templating features. > > jon > > Here's my updated Code.gs: > > var myHTML = (function myHTML () { > 'use strict'; > var htmlFile = 'index_r5', > loadVersion = 'a', > getHF = function () {return htmlFile;}, > getLV = function () {return htmlFile + " ver: " + loadVersion;}, > that = {}; > > that.getHtmlFile = getHF; > that.getLoadVersion = getLV; > return that; > }()); > > function getHtmlFile(){ > return myHTML.getHtmlFile(); > } > > function getLoadVersion(){ > return myHTML.getLoadVersion(); > } > > function doGet() { > 'use strict'; > var aWebPage, awpTitle, ss, qTitle, qSymbol, qName; > > // switching from index to page as per best pactices tutorial > try { > aWebPage = HtmlService.createHtmlOutputFromFile(getHtmlFile()) > .setSandboxMode(HtmlService.SandboxMode.NATIVE); > awpTitle = getLoadVersion(); > aWebPage.setTitle(awpTitle); > > Logger.log('all went well with doGet....'); > } catch (dgError) { > Logger.log('there is an error in the doGet code'); > } > return aWebPage; > } > > Here's my index_r5.html > > <div> > > <script type="text/javascript" src="https://www.google.com/jsapi > "></script> > <script type="text/javascript"> > /*jslint regexp: true, sloppy: false, vars: true, white: true */ > /*global google, alert, document, runIt */ > // > // I use crockford's jslint.com to check my edits for errors. > // Some think he's too much about format, an alternative is > jshint.com > // I would also recommend validating your markup as well. > // There's just a lot of problems these tools take care of. > > // > > google.load('visualization', '1', {packages: ['corechart','table']}); > google.setOnLoadCallback(runIt); > > // var window.runIt; > > > function runIt() { > 'use strict'; > var cRH, > vLbl, > myChart, > myDC, > myLog, > theLoadVersion = "lv unknown", > jsVersion = "B onLoad testing"; > > myLog = function myLog(aMessage){ > var id2Check = "chart_log0", > theExistingHTML, > theNewHTML, > byIDCheck, > preP = "<p>", > postP = "</p>"; > > try { > byIDCheck = document.getElementById(id2Check); > try { > theExistingHTML = byIDCheck.innerHTML; > theNewHTML = theExistingHTML + preP + "byIDMessage: > " + aMessage + postP; > byIDCheck.innerHTML = theNewHTML; > // byIDCheck: [domado object HTMLDivElement DIV] > // byIDCheck.insertAdjacentHTML("beforeEnd", > theNewHTML); > } catch (innerHTMLError) { > alert("innerHTMLError: " + innerHTMLError.name + " " > + innerHTMLError.message); > } > } catch (theIDError) { > alert("theIDError: " + theIDError.name + " " + > theIDError.message); > } > }; > > vLbl = function addVersionLabel() { > var versionLabel = theLoadVersion + " / " + jsVersion; > document.getElementById("pieChartTop").innerHTML = > versionLabel; > }; > > cRH = function chartReadyHandler() { > myLog("the chart is ready!!!"); > > alert("the chart is ready!!!"); > }; > > myDC = function myDrawChart() { > var data = google.visualization.arrayToDataTable([ > ['Task', 'Hours per Day'], > ['Work', 11], > ['Eat', 2], > ['Commute', 2], > ['Watch TV', 2], > ['Sleep', 7] > ]), > options = { > title: 'My Daily Activities' > }; > alert("running myDC..."); > > try { > myChart = new > google.visualization.PieChart(document.getElementById('piechart')); > try { > google.visualization.events.addListener(myChart, > 'ready', cRH); > myChart.draw(data, options); > > } catch (addlisError) { > alert("myChart/listener failed..." + addlisError.name + > ": " + addlisError.message); > } > } catch (newChartError) { > alert("newChartError: " + newChartError.name + " " + > newChartError.message); > // newChartError: TypeError guestNode is null > } > }; > > google.script.run.withSuccessHandler(function > (parm){theLoadVersion=String(parm);vLbl();}).getLoadVersion(); > > > alert("calling myDC"); > myDC(); > myLog("this was testing myLog"); > myLog("this is a second message"); > > } > > alert("at the end..."); > </script> > > <div id="piechart" style="width: 1100px; height: 600px; > max-width:100%; overflow:scroll;"> > <p id="pieChartTop">This is the chart div</p> > </div> > <div id="chart_log0" style="border: 1px solid black; height: 400px; > overflow:scroll;"> > <p>This is the chart_log div zero</p> > <p>aaaa</p> > </div> > <div id="logTable" style="border: 1px solid black; height: 400px; > overflow:scroll;"> > </div> > <script> > alert("at the end of the body"); > </script> > </div> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > http://groups.google.com/group/google-visualization-api. > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> - 978-394-1058 [email protected] <[email protected]> 5CC, Cambridge MA [email protected] <[email protected]> 9 Juniper Ridge Road, Acton MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
