AnsweredAssumed Answered

esri.dijit.Popup calling a function that inserts script

Question asked by bbieb on Apr 3, 2012
Latest reply on Aug 15, 2013 by csburris
I have a esri.InfoTemplate that calls a function.  Within the function I am setting content of a dojox.layout.ContentPane.  I am utilizing a dojox content pane because I need a piece of javascript code to execute.  Eventually I need to get a reference to a node within the dojox.layout.ContentPane, whether that node was part of the content or dynamically created.  The problems is that I cannot get a reference to a node within the ContentPane in IE 8.  The code works fine in FF, Safari, and Chrome.

My question is, is there a way to get a reference to a node in the content pane in IE 8 utilizing the code below?

Entire Process:
1. identify feature
2. process the identified features by attaching script as a feature attribute
3. set feature info template to a function
4. function creates a dojox.layout.ContentPane
5. function retrieves script from feature
6. function sets script/node as the content
7. returns content pane domNode to feature
8. if all goes correctly, a video plays within the popup window

Below is simplified code to illustrate the problem in IE 8.

        //called by maptip each time the maptip record selector moves to that graphic      function getLiveViewContent(graphic) {     var cpX = new dojox.layout.ContentPane({id:"videoContainer"});               //the node is part of the content of the contentpane but when the content is set, IE 8 cannot find the node     var videoNode1 = "<div id='videoNode1'>Loading.....</div><scr" + "ipt type='text/javascript'> var cnNode;var vidNode; var i=0;function checkContainter(){while(cnNode==null&&i<50){cnNode = dijit.byId('videoContainer');if (cnNode!=null){console.log('got cnNode');}i++;}}checkContainter();i=0;function checkVideoNode(){while(vidNode==null&&i<50){vidNode = dojo.byId('videoNode1');i++;console.log(i);if (vidNode!=null){console.log('got vidNode');}}}checkVideoNode();console.log('done');<\/scr" + "ipt>";          //this code retrieves an already created node within the document and appends that node to the container node.  In IE 8, after the append the dojo.byID('videodiv') is null     var videoNode2 = "<scr" + "ipt type='text/javascript'> var cnNode;var vidNode; var i=0;function checkContainter(){while(cnNode==null&&i<50){cnNode = dijit.byId('videoContainer');if (cnNode!=null){console.log('got cnNode');vidNode = dojo.byId('videodiv');if (vidNode!=null){console.log('got vidNode');}cnNode.containerNode.appendChild(vidNode);}i++;}}checkContainter();i=0;var checkNode;function checkVideoNode(){while(checkNode==null&&i<50){checkNode = dojo.byId('videodiv');i++;console.log(i);}}checkVideoNode();console.log('done');<\/scr" + "ipt>";      //var data = graphic.attributes.liveviewdata;     //data = data.replace("jwplayer",videoNode);     cpX.set("content", videoNode2);     return cpX.domNode;      }    identifiedFeatures.addCallback(function(response) {    return dojo.map(response, function(result) {     var feature = result.feature;     //console.log(feature);       if(feature.attributes.liveviewdata!=null && feature.attributes.liveviewdata!="" ){        var template = new esri.InfoTemplate("",getLiveViewContent);        feature.setInfoTemplate(template);        }     return feature;      });    });     map.infoWindow.setFeatures([ identifiedFeatures ]);     map.infoWindow.show(evt.mapPoint);     }   

Outcomes