Hi Tim,
I have the scale in the header-controller widget, but it does not change with the map. It gets the initial scale of 1:180,000, but is static after startup. Below is what the postCreate and startup functions look like:
postCreate: function() {
this.inherited(arguments);
this._processGroupSetting();
this.switchableElements.title = this.titleNode;
this.switchableElements.links = this.linksNode;
this.switchableElements.subtitle = this.subtitleNode;
domClass.add(this.scaleInfo, "coordinate-background"); //I'm not sure what to reference here
this.own(on(this.map, "extent-change", lang.hitch(this, this.onExtentChange)));//added for scale
if (this.position && this.position.height) {
this.height = this.position.height;
}
// if (!this.appConfig.portalUrl) {
html.setStyle(this.signInSectionNode, 'display', 'none');
// } else {
// html.setStyle(this.signInSectionNode, 'display', '');
// }
if (this.appConfig && this.appConfig.logo) {
this.logoNode.src = this.appConfig.logo;
html.removeClass(this.logoNode, 'hide-logo');
} else {
this.logoNode.src = "";
html.addClass(this.logoNode, 'hide-logo');
}
this.switchableElements.title.innerHTML =
utils.sanitizeHTML(this.appConfig.title ? this.appConfig.title : '');
this.switchableElements.subtitle.innerHTML =
utils.sanitizeHTML(this.appConfig.subtitle ? this.appConfig.subtitle : '');
this._createDynamicLinks(this.appConfig.links);
this._setElementsSize();
this.own(on(this.domNode, mouse.enter, lang.hitch(this, function() {
var title = '';
var portalUrl = this.appConfig && this.appConfig.portalUrl || '';
var server = portalUrlUtils.getServerByUrl(portalUrl);
if (portalUrlUtils.isArcGIScom(server)) {
server = 'ArcGIS.com';
}
if (server) {
title = this.nls.signInTo + ' ' + server;
}
this.signinLinkNode.title = title;
})));
},
startup: function() {
this.inherited(arguments);
var MyMap = this.map; //start of addition for scale
var MyScaleWindow = this.scaleInfo.innerHTML;
var MyScaleTest = this.scaleInfo;
var scale = esri.geometry.getScale(MyMap);
var myNumber = dojoNumber.format(scale, {
places: 0
});
htmlSet.set(MyScaleTest, "Scale: 1 : " + myNumber);
this.map.on("extent-change", getmyscale);
function getmyscale() {
var scale = esri.geometry.getScale(MyMap);
var myNumber = dojoNumber.format(scale, {
places: 0
});
htmlSet.set(MyScaleTest, ", Scale: 1 : " + myNumber);
console.log("Got it");
}; //end of addition for scale
this.resize();
// this.timeoutHandle = setTimeout(lang.hitch(this, this.resize), 100);
},
Any help would be appreciated, even if it's to tell me the scale cannot go in the header-controller widget. Thanks.
William