AnsweredAssumed Answered

Cannot read property 'toScreen' of undefined

Question asked by alterwiel on Oct 6, 2015
Latest reply on Oct 7, 2015 by rscheitlin

I have this simple chunk of code that fails with the error:

"TypeError: Cannot read property 'toScreen' of undefined at p.show (http://js.arcgis.com/3.14/init.js:199"

 

It fails at this.map.infoWindow.show(selectedAddress[0].geometry, selectedAddress[0].geometry);

 

              

var infoTemplate = new InfoTemplate();
infoTemplate.title = "Address";
infoTemplate.content = "${ADDRESS}</br>${LOCALITY}";
selectedAddress[0].setInfoTemplate(infoTemplate);
this.map.infoWindow.setFeatures(selectedAddress);
this.map.infoWindow.show(selectedAddress[0].geometry, selectedAddress[0].geometry);

Can anyone see what I'm doing wrong?

 

Message was edited by: Andrew Terwiel

 

I have it working now, but this looks like a hack to me.           

 

var that = this.map._mapParams.infoWindow;
var infoTemplate = new InfoTemplate();
infoTemplate.title = "Address";
infoTemplate.content = "${ADDRESS}</br>${LOCALITY}";
selected[0].setInfoTemplate(infoTemplate);
that.setFeatures(selected);
that.show(selected[0].geometry);

Outcomes