Select to view content in your preferred language

Sometimes the home button does not load on the map

3103
10
12-17-2013 06:51 AM
EdwardSohn1
Emerging Contributor
Following is the code that loads the home button on the map:
but sometimes the home button does not load.
(This also happens to the geolocation button as well).
Please see attached screenshot.  This is where the home button and the geoloc button "did" load.
But sometimes these buttons do not load (just missing).  Otherwise the application functions normally.

This seems to happen initially when the browser is started.  And once the refresh browser button is hit, usually the home/geoloc buttons do load.  Sometimes however, this condition persists until after several refreshes.

Other times other parts of the UI fail to load (such as the tools buttons, and even sections of the basemap).

Users can hit refresh browser to load the map completely, but would like to avoid this scenario.


var homeButton = $('<div class="esriSimpleSliderIncrementButton"><img style="vertical-align: -2px;" src="map.web/resources/icons/mapcommand-home.png"></div>');

homeButton.fastClick(function () {
if( homeClickCallback && typeof homeClickCallback == 'function' )
  homeClickCallback(map._params.extent);
else
  map.setExtent(map._params.extent);
});
  
$(map.container).find('.esriSimpleSlider div:nth-child(1)').after(homeButton);

///////////////////////////////////////////////////////////////////////////////////////

Also this may be related issue but sometimes get the javascript error:

"require is not defined" at (and I may not be doing the following correctly but...):
This happened sporadically (very rarely) and seem independent of the above behavior however:

  require(["dojo"], function (dojo) {
                dojo.addOnLoad(
                    function () {
                        require([
                                "dojo/i18n!./map.web/resources/nls/template.js?v=" + version,
                                "storymaps/ui/loadingIndicator/LoadingIndicator",
                                "esri/urlUtils",
                                "esri/layers/GraphicsLayer",
                                "esri/layers/FeatureLayer",
                                "storymaps/utils/Helper",
                                "dijit/TooltipDialog",
                                "esri/renderers/SimpleRenderer",
                                "esri/tasks/query",
                                "esri/lang",
                                "dojo/dom-style",
                                "dijit/popup",
                                "esri/graphic",
                                "esri/dijit/BasemapGallery",
                                "esri/dijit/Scalebar",
                                "dojo/fx/Toggler",
                                "dojo/fx",
                                "dojo/dom",
                                "dojo/on",
                                "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane", "esri/arcgis/utils", "dojo/parser",
                                "templateConfig/commonConfig.js?v=" + version,
                                "dojo/domReady!",
                                "dojo/ready"
                        ], function (
                                _i18n,
                                LoadingIndicator,
                                urlUtils,
                                GraphicsLayer,
                                FeatureLayer,
                                Helper,
                                TooltipDialog,
                                SimpleRenderer,
                                _query,
                                esriLang,
                                domStyle,
                                dijitPopup,
                                Graphic,
                                BasemapGallery,
                                Scalebar,
                                Toggler,
                                coreFx,
                                dom,
                                on
                            ) { ....
0 Kudos
10 Replies
KenBuja
MVP Esteemed Contributor
Could it be a problem in connecting to the Esri's JSAPI? Take a look at this post to see if this solution works for you.
0 Kudos