<script> var dojoConfig = { parseOnLoad: true, packages: [{ "name": "agsjs", //"location": location.pathname.replace(/\/[^/]+$/, "") + '/agsjs' "location": 'http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/xbuild/agsjs' // for xdomain load }] }; </script>
<div id="sidebarCollapseButton" class="sidebarCollapseButton.close" style="display:none;"></div> <div id="leftDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left'" style="display:block;"> <div id="paneLayers" class="titlePane" onClick="openSide();" data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Layers', open: true" > <div id="divLegendHolder"></div> </div> <div id="paneEditor" class="titlePane" data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Editor Tools', open: false" > <div id="editToolbarPane" class = "toolbarContentPane_TitlePane" dojotype="dijit/layout/ContentPane" region="top"> <div id="editToolbar" data-dojo-type="dijit/Toolbar"> <div id ="templateDiv"> </div> <div id ="editorDiv"> </div> </div> </div> <div id="editTemplateHolder" ></div> </div> </div>
function openSide () { domStyle.set(leftDiv.domNode, 'display', 'block'); domClass.remove(sidebarCollapseDiv, 'open'); domClass.add(sidebarCollapseDiv, 'close'); }
require(["dojo/dom", "dojo/dom-class", "dojo/on", "dojo/dom-style"], function (dom, domClass, dojoOn, domStyle) { var sidebarCollapseDiv = dom.byId('sidebarCollapseButton'); var leftDiv = dijit.byId("leftDiv"); dojoOn(sidebarCollapseDiv, 'click', function (evt) { if (leftDiv.domNode.style.display === "none") { //domStyle.set(sidebarCollapseDiv, 'display', 'block'); domStyle.set(leftDiv.domNode, 'display', 'block'); domClass.remove(sidebarCollapseDiv, 'open'); domClass.add(sidebarCollapseDiv, 'close'); } else { //domStyle.set(sidebarCollapseDiv, 'display', 'none'); domStyle.set(leftDiv.domNode, 'display', 'none'); domClass.remove(sidebarCollapseDiv, 'close'); domClass.add(sidebarCollapseDiv, 'open'); } leftDiv.resize(); //domStyle.set(dom.byId('mapDiv'), 'width', '100%'); dijit.byId('mainDiv').resize(); _map.resize(true); _map.reposition(); //dijit.byId("mapDiv").refresh(); }); domStyle.set(sidebarCollapseDiv, 'display', 'block'); });
domStyle.set(leftDiv.domNode, 'display', 'block'); domClass.remove(sidebarCollapseDiv, 'open'); domClass.add(sidebarCollapseDiv, 'close');
And would the other code you supplied (var titlePane = dijit.byId("paneEditor");...) go into that same function?
<div id="baseLayersDropDown" class="baseLayersDiv" onClick="leftPanel1();" data-dojo-type="dijit/form/DropDownButton" data-dojo-props="iconClass:'',label:'Legend', showLabel: true, disabled: false"> <div data-dojo-type="dijit/TooltipDialog" class="tooltipDialogLayers"> <div id="divBaseLegendHolder" ></div> </div> </div>
function leftPanel1 () { domStyle.set(leftDiv.domNode, 'display', 'block'); }
Hi Diana, thanks for the reply. I was able to implement some of that code into one of my existing drop down menus to improve it. But what I am trying to do with the legend is when you select the legend button, the left panel expands open with the legend contained inside it. And then I would like to have another button for my editing tools, where the tools would also appear in the left panel when the button is clicked. I don't think that will be very hard to do though once I figure out how to go about making the left panel expand when a button is selected. If there's any way you could assist me in getting started with this, I would really appreciate it.Thanks, Ryan
var titlePane = dijit.byId("paneEditor"); dojo.connect(titlePane, "toggle", function () { if (titlePane.open && _mapController.GetEnableEditing()) { if (_map.getScale() < _mapController.minEditScale) { if (!_mapController.isTemplatePickerInitialized) { initializeEditorTemplate(); titlePane.resize(); } if (!_mapController.isAttributeInspectorInitialized) { initializeAttributeInspector(); } } } });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.