Measurement: work with local API?

501
1
02-18-2013 11:00 AM
KevinMacLeod1
Occasional Contributor III
We are running a site with the API local. We put Dojo in its own folder (outside the folder with the ESRI API files) for organizational purposes.

I am not sure but I think this is causing a problem for the Measurement widget. in Firebug it says "this.distance is undefined" on line 15, Measurement.js. I copied it in from the Measurement sample. So, the titlePane shows up in the upper right of course (using HTML right from ESRI sample) but the dijit never instantatiates. The 3 little icons of the measure tools never show up, only the divider line below where they should be.

I'm guessing there an issue with pathing with Measurement.js? I.e. a hardcoded path or something depending on dojo being reached with relative paths ../ or the like?

Dojo highlights the fact it is a modular system. So in theory this should work just fine. The rest of our site and widgets work great. Also, we re-pointed to all Dojo and extra packages (i.e. AGSJS TOC, WURadar) with dojoConfig.

I have put the code on GitHub. ESRI staff or anyone else seen this, and have any advice or know what is happening here? Thanks!
https://github.com/kevinsagis/MeasureWidgetLocalAPI

Note, I've stripped the actual ESRI API files due to concerns for licensing/redistributing, but I assure, they're just as they come in the API (minus the Dojo 1.8 which are in the separate folder as is apparent in the GitHub repo)...the esri API files were in  js / lib / esri.  However, are we allowed to post the API? If so I can re-add them back for convenience...but just put ESRI API files into the empty esri folder here in js/lib/esri and this site will run, just not the Measurement.
0 Kudos
1 Reply
JianHuang
Occasional Contributor III
There is no hardcoded path in measurement widget.
If you didn't see the icons, please try to set it in the CSS and let me know if it works.
.distanceIcon {
background-image:url(./Measure_Distance16.png); //your image url
}
But this shouldn't cause the error that you described.
0 Kudos