Solved! Go to Solution.
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>TEST</title> <!-- CSS --> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0px; overflow: hidden; font-family: Helvetica, Sans-Serif; } #navToolbar { position: absolute; padding: 0px; margin: 0px; top: 0px; left: 0px; right: 0px; } #map { padding: 0px; } </style> <!-- Code --> <script src="http://js.arcgis.com/3.9/"></script> <script> require(["esri/map", "esri/dijit/BasemapGallery", "esri/dijit/Basemap", "esri/dijit/BasemapLayer", "dijit/registry", "dojo/parser", "dijit/form/DropDownButton", "dijit/DropDownMenu", "dijit/MenuItem", "dijit/layout/ContentPane", "dijit/layout/BorderContainer", "dijit/Toolbar", "esri/dijit/Print","dojo/domReady!"], function(Map, BasemapGallery, Basemap, BasemapLayer, registry, parser, DropDownButton, DropDownMenu, MenuItem, ContentPane, BorderContainer, Toolbar) { parser.parse(); var map = new Map("map", { basemap : "topo", center : [-98, 39], zoom : 4 }); // Create custom list of basemaps for the gallery basemapsList = []; var esriAerial = new Basemap({ layers : [new BasemapLayer({ url : "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" })], title : "ESRI Aerial", thumbnailUrl : "images/world_imagery.png" }); basemapsList.push(esriAerial); // Add the basemap gallery var basemapGallery = new BasemapGallery({ showArcGISBasemaps : false, basemaps : basemapsList, map : map }); basemapGallery.startup(); // Add the basemap gallery in drop down menu on toolbar if (basemapGallery.loaded) { createBasemapGallery(); }; function createBasemapGallery() { for ( i = 0; i < basemapGallery.basemaps.length; i++) {( function(x) { registry.byId('basemapMenu').addChild(new MenuItem({ label : basemapGallery.basemaps.title, onClick : function() { basemapGallery.select(basemapGallery.basemaps.id); } })); }(i)); } } }); </script> </head> <body class="claro infinity"> <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline',gutters:false,liveSplitters:false" style="width:100%; height:100%;"> <div id="navToolbar" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'"> <div data-dojo-type="dijit/Toolbar"> <div label="Basemaps" data-dojo-type="dijit/form/DropDownButton"> <div data-dojo-type="dijit/Menu" id="basemapMenu"> <!--The menu items are dynamically created using the basemap gallery layers--> </div> </div> </div> </div> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div> </div> </body> </html>
Hi Alex - I've done some of this too, maybe can help. I don't think I quite understand yet -- are you using dijit/DropDownMenu in a dijit/Toolbar? And then within that drop down menu is a title pane? I feel like adding a <div class="white"> to change the color of the content pane would work instead of using the title pane, but I'm just brainstorming.
Yes. I am using dijit/DropDownMenu in a dijit/Toolbar and added a title pane in the drop down menu in order to get a white canvas to display my different map elements (such as basemap gallery, bookmarks, layers...). I will try to add the <div class="white"> and see if that works.
Thank you for your help!
Alex
<section data-dojo-type="dijit/form/DropDownButton" data-dojo-props="iconClass:'bookmarks', showLabel:false, style:'float:left'"> <span>Bookmarks</span> <section class="white" data-dojo-type="dijit/layout/ContentPane" style="width:auto; !important; height:auto !important; overflow:auto;"> <section id="bookmarks"> </section> </section> </section>
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>TEST</title> <!-- CSS --> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0px; overflow: hidden; font-family: Helvetica, Sans-Serif; } #navToolbar { position: absolute; padding: 0px; margin: 0px; top: 0px; left: 0px; right: 0px; } #map { padding: 0px; } </style> <!-- Code --> <script src="http://js.arcgis.com/3.9/"></script> <script> require(["esri/map", "esri/dijit/BasemapGallery", "esri/dijit/Basemap", "esri/dijit/BasemapLayer", "dijit/registry", "dojo/parser", "dijit/form/DropDownButton", "dijit/DropDownMenu", "dijit/MenuItem", "dijit/layout/ContentPane", "dijit/layout/BorderContainer", "dijit/Toolbar", "esri/dijit/Print","dojo/domReady!"], function(Map, BasemapGallery, Basemap, BasemapLayer, registry, parser, DropDownButton, DropDownMenu, MenuItem, ContentPane, BorderContainer, Toolbar) { parser.parse(); var map = new Map("map", { basemap : "topo", center : [-98, 39], zoom : 4 }); // Create custom list of basemaps for the gallery basemapsList = []; var esriAerial = new Basemap({ layers : [new BasemapLayer({ url : "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" })], title : "ESRI Aerial", thumbnailUrl : "images/world_imagery.png" }); basemapsList.push(esriAerial); // Add the basemap gallery var basemapGallery = new BasemapGallery({ showArcGISBasemaps : false, basemaps : basemapsList, map : map }); basemapGallery.startup(); // Add the basemap gallery in drop down menu on toolbar if (basemapGallery.loaded) { createBasemapGallery(); }; function createBasemapGallery() { for ( i = 0; i < basemapGallery.basemaps.length; i++) {( function(x) { registry.byId('basemapMenu').addChild(new MenuItem({ label : basemapGallery.basemaps.title, onClick : function() { basemapGallery.select(basemapGallery.basemaps.id); } })); }(i)); } } }); </script> </head> <body class="claro infinity"> <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline',gutters:false,liveSplitters:false" style="width:100%; height:100%;"> <div id="navToolbar" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'"> <div data-dojo-type="dijit/Toolbar"> <div label="Basemaps" data-dojo-type="dijit/form/DropDownButton"> <div data-dojo-type="dijit/Menu" id="basemapMenu"> <!--The menu items are dynamically created using the basemap gallery layers--> </div> </div> </div> </div> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div> </div> </body> </html>
I have been using 'Menu' and 'MenuItem' within the 'DropDownButton' (http://dojotoolkit.org/reference-guide/1.9/dijit/form/DropDownButton.html). The background is automatically white. Below is an example of adding a basemap gallery using the drop down on a toolbar-- hopefully that could serve as a template for your other tools, let me know if that helps.
HTML:<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>TEST</title> <!-- CSS --> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0px; overflow: hidden; font-family: Helvetica, Sans-Serif; } #navToolbar { position: absolute; padding: 0px; margin: 0px; top: 0px; left: 0px; right: 0px; } #map { padding: 0px; } </style> <!-- Code --> <script src="http://js.arcgis.com/3.9/"></script> <script> require(["esri/map", "esri/dijit/BasemapGallery", "esri/dijit/Basemap", "esri/dijit/BasemapLayer", "dijit/registry", "dojo/parser", "dijit/form/DropDownButton", "dijit/DropDownMenu", "dijit/MenuItem", "dijit/layout/ContentPane", "dijit/layout/BorderContainer", "dijit/Toolbar", "esri/dijit/Print","dojo/domReady!"], function(Map, BasemapGallery, Basemap, BasemapLayer, registry, parser, DropDownButton, DropDownMenu, MenuItem, ContentPane, BorderContainer, Toolbar) { parser.parse(); var map = new Map("map", { basemap : "topo", center : [-98, 39], zoom : 4 }); // Create custom list of basemaps for the gallery basemapsList = []; var esriAerial = new Basemap({ layers : [new BasemapLayer({ url : "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" })], title : "ESRI Aerial", thumbnailUrl : "images/world_imagery.png" }); basemapsList.push(esriAerial); // Add the basemap gallery var basemapGallery = new BasemapGallery({ showArcGISBasemaps : false, basemaps : basemapsList, map : map }); basemapGallery.startup(); // Add the basemap gallery in drop down menu on toolbar if (basemapGallery.loaded) { createBasemapGallery(); }; function createBasemapGallery() { for ( i = 0; i < basemapGallery.basemaps.length; i++) {( function(x) { registry.byId('basemapMenu').addChild(new MenuItem({ label : basemapGallery.basemaps.title, onClick : function() { basemapGallery.select(basemapGallery.basemaps.id); } })); }(i)); } } }); </script> </head> <body class="claro infinity"> <div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline',gutters:false,liveSplitters:false" style="width:100%; height:100%;"> <div id="navToolbar" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'"> <div data-dojo-type="dijit/Toolbar"> <div label="Basemaps" data-dojo-type="dijit/form/DropDownButton"> <div data-dojo-type="dijit/Menu" id="basemapMenu"> <!--The menu items are dynamically created using the basemap gallery layers--> </div> </div> </div> </div> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div> </div> </body> </html>
Excellent, glad to help!
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>TEST</title> <!-- CSS --> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <!-- Code --> <script src="http://js.arcgis.com/3.9/"></script> <style> html, body, #map { padding: 0; margin: 0; height: 100%; overflow: hidden; } </style> <script> require(["esri/map", "dojo/parser", "dojo/on", "esri/dijit/BasemapGallery", "dijit/registry", "dijit/MenuItem", "dijit/Toolbar", "dijit/form/Button", "dijit/form/DropDownButton", "dijit/DropDownMenu", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/layout/AccordionContainer"], function(Map, parser, on, BasemapGallery, registry, MenuItem) { parser.parse(); var map = new Map("map", { basemap : "topo", center : [-98, 39], zoom : 4 }); // Add the basemap gallery var basemapGallery = new BasemapGallery({ showArcGISBasemaps : true, map : map, }); basemapGallery.startup(); if (basemapGallery.showArcGISBasemaps) { basemapGallery.on("load", function() { console.log('base'); createBasemapGallery(); }); } else { createBasemapGallery(); } // Add the basemap gallery in drop down menu on toolbar function createBasemapGallery() { for ( i = 0; i < basemapGallery.basemaps.length; i++) {( function(x) { console.log(basemapGallery.basemaps.title); registry.byId('basemapMenu').addChild(new MenuItem({ label : basemapGallery.basemaps.title, onClick : function() { basemapGallery.select(basemapGallery.basemaps.id); } })); }(i)); } } }); </script> </head> <!--ESRI's layout--> <body class="claro"> <!--Border Container settings--> <section data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="gutters:true, liveSplitters:true" style="width: 100%; height: 100%; padding-top:0px;"> <!--Border Container settings--> <!-- Tags end on line afterwards to eliminate any whitespace --> <!--This is the header of the application--> <section data-dojo-type="dijit/layout/ContentPane" id="header" data-dojo-props="region:'top'"> <h1>Fire Plan Web Mapping Application</h1> </section> <section data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left', splitter:true"> <section data-dojo-type="dijit/layout/AccordionContainer"> <section data-dojo-type="dijit/layout/ContentPane" id="legendPane" data-dojo-props="title:'Legend', selected:true"> <section id="tocsection"> TOC Placeholder </section> </section> </section> </section> <section id="map" class="map" data-dojo-type="dijit/layout/ContentPane" region="center" data-dojo-props="region:'center'"> <section id="fancy" data-dojo-type="dijit/Toolbar" style="background-color:black; height:35px;"> <!--Additional widgets go below there--> <div label="Basemaps" data-dojo-type="dijit/form/DropDownButton"> <div data-dojo-type="dijit/Menu" id="basemapMenu"></div> </div> </section> </section> </section> </body> </html>
Man I just went down a rabbit hole with this one...I'm pretty much a newb as well so sorry I can't be of more help. I had to strip down your code a bunch to get this to work so the skeleton is below. However, I did revisit an issue with the basemapGallery dijit that I encountered before and finally got it resolved. If 'showArcGISBasemaps:true' is set then it's important to use the basemaps.on("load") syntax. FYI if it's ever set to false this will NEVER fire because load only fires for fetching ArcGIS.com basemaps (which is the issue I encountered before building a custom list). Anywho...I tried to mimic your set-up below so you could try to add to it from a working base.<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>TEST</title> <!-- CSS --> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <!-- Code --> <script src="http://js.arcgis.com/3.9/"></script> <style> html, body, #map { padding: 0; margin: 0; height: 100%; overflow: hidden; } </style> <script> require(["esri/map", "dojo/parser", "dojo/on", "esri/dijit/BasemapGallery", "dijit/registry", "dijit/MenuItem", "dijit/Toolbar", "dijit/form/Button", "dijit/form/DropDownButton", "dijit/DropDownMenu", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/layout/AccordionContainer"], function(Map, parser, on, BasemapGallery, registry, MenuItem) { parser.parse(); var map = new Map("map", { basemap : "topo", center : [-98, 39], zoom : 4 }); // Add the basemap gallery var basemapGallery = new BasemapGallery({ showArcGISBasemaps : true, map : map, }); basemapGallery.startup(); if (basemapGallery.showArcGISBasemaps) { basemapGallery.on("load", function() { console.log('base'); createBasemapGallery(); }); } else { createBasemapGallery(); } // Add the basemap gallery in drop down menu on toolbar function createBasemapGallery() { for ( i = 0; i < basemapGallery.basemaps.length; i++) {( function(x) { console.log(basemapGallery.basemaps.title); registry.byId('basemapMenu').addChild(new MenuItem({ label : basemapGallery.basemaps.title, onClick : function() { basemapGallery.select(basemapGallery.basemaps.id); } })); }(i)); } } }); </script> </head> <!--ESRI's layout--> <body class="claro"> <!--Border Container settings--> <section data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="gutters:true, liveSplitters:true" style="width: 100%; height: 100%; padding-top:0px;"> <!--Border Container settings--> <!-- Tags end on line afterwards to eliminate any whitespace --> <!--This is the header of the application--> <section data-dojo-type="dijit/layout/ContentPane" id="header" data-dojo-props="region:'top'"> <h1>Fire Plan Web Mapping Application</h1> </section> <section data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left', splitter:true"> <section data-dojo-type="dijit/layout/AccordionContainer"> <section data-dojo-type="dijit/layout/ContentPane" id="legendPane" data-dojo-props="title:'Legend', selected:true"> <section id="tocsection"> TOC Placeholder </section> </section> </section> </section> <section id="map" class="map" data-dojo-type="dijit/layout/ContentPane" region="center" data-dojo-props="region:'center'"> <section id="fancy" data-dojo-type="dijit/Toolbar" style="background-color:black; height:35px;"> <!--Additional widgets go below there--> <div label="Basemaps" data-dojo-type="dijit/form/DropDownButton"> <div data-dojo-type="dijit/Menu" id="basemapMenu"></div> </div> </section> </section> </section> </body> </html>