basemapGallery dropdown display issue

684
2
01-17-2013 03:19 PM
by Anonymous User
Not applicable
Original User: amouton

I have spend many hours with this issue.  If I navigate to my page, the basemapGallery (gallery_error.jpg) will display the gallery outside the button that is also missing.  It almost seems the digit is not loading properly.  If I do a page refresh, everything will then loads properly (gallery_good.jpg).  Has anyone experienced this?

I am using multiple technologies.  The application is fed through Oracle Apex which calls a javascript function that uses ExtJS (Sencha).  The ExtJS creates the div tags with a tag:
region: 'center',
     border:false, 
     style: 'padding-left:15px;',
         html:  '<div data-dojo-type="dijit.layout.BorderContainer" ' +
         'data-dojo-props="design:\'headline\', gutters:false" ' +
         'style="width:100%;height:100%;margin:0;">' +
    '<div id="map" ' +
         'data-dojo-type="dijit.layout.ContentPane" ' +
         'data-dojo-props="region:\'center\'">' +
      '<div style="position:absolute; right:20px; top:10px; z-Index:999;">' +
        '<div data-dojo-type="dijit.TitlePane" ' +
             'data-dojo-props="title:\'Switch Basemap\', closable:false, open:false">' +
          '<div data-dojo-type="dijit.layout.ContentPane" style="width:380px; height:280px; overflow:auto;">' +
            '<div id="basemapGallery"></div>' +
          '</div>' +
        '</div>' +
      '</div>' +
    '</div>' +
    '</div>',

Then at the end of that function, the:
dojo.ready(mapInit);

is called which is your standard map and gallery setup from the sample codes.  Any ideas would be greatly appreciated.  Thanks.
0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: bdraper_USGS

I had the same problem you describe. I finally solved it by placing the script tags referencing the ArcGIS API and the JS file containing the code (which was in a separate file from my index.html root) below the dojoConfig object.

As long as the dojoConfig object is below the script tags referencing the Javascript, the config properties will be ignored, including parseonLoad:true, which is required for the TitlePane to work.

Here is what it should look like. The order is key:

[HTML]
<script type="text/javascript">
     var dojoConfig = {
         parseOnLoad: true,
  packages: [
             { name: "modules", location: location.pathname.replace(/\/[^/]+$/, "") + "\/modules" }
            ]
        };
</script>
   
<!-- ArcGIS Javascript API reference -->
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/" type="text/javascript"></script> 

<!-- Mapper js file -->
<script src="js/STN_JS_2.js" type="text/javascript"></script>
[/HTML]
0 Kudos
IB1
by
Occasional Contributor
I'm having a similar problem with the gallery. Granted I'm new to Javascript and am slowly learning how it works.

Here is the code I have put together:
http://pastebin.com/H4t8WF1x

Basically it just combines the Basemap Gallery widget with the Legend widget.

Now, when I load the index.html my one ArcGISDynamicMapServiceLayer loads fine, but the basemap does not work. If I click the Basemap gallery and choose a different basemap the ArcGISDynamicMapServiceLayer disappears and the basemap still does not work.

If I remove this from the code:

var cable= new esri.layers.ArcGISDynamicMapServiceLayer("http://xxxxx.com/arcgis/rest/services/Electric/Data/MapServer/", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
       
map.addLayers([cable]);


The Basemap Gallery works fine.

Why doesn't the gallery work when I have my layer load?
0 Kudos