Glad I found this thread - I was having the same issue where the print button was adding itself above or below the toolbar next to the other tools. Adding float:left to the CSS fixed that problem.Now, though, the print button screws up the "look" of the toolbar. I have three other items added to the toolbar, all of them dijit.form.DropDownButtons, which all line up neatly when added to the toolbar. Adding the print button - I suppose since it's a "button" not a "DropDownButton" - messes with the alignment. See the attached screenshot.So far I've left the CSS of the drop down buttons the default claro style, but before I go customizing them I'd like to have the Print button match their style. Is there a way I can call in the print dijit as a .dropdownbutton instead of a .button, so the styles match?
//get the toolbar var theToolBar = dojo.byId("navToolbar"); //create the print dijit app.printer = new esri.dijit.Print({ "map": app.map, "templates": templates, url: app.printURL }, theToolBar);//.placeAt("navToolbar"); //, //dojo.byId("print_button")); //theToolBar); // theToolBar.addChild(app.printer, 6); app.printer.startup();
<div id="navToolbar" data-dojo-type="dijit.Toolbar"> <div data-dojo-type="dijit.form.Button" id="zoomin" data-dojo-props="iconClass:'zoominIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN); setActiveTool('zoomin');}">Zoom In</div> <div data-dojo-type="dijit.form.Button" id="zoomout" data-dojo-props="iconClass:'zoomoutIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.ZOOM_OUT); setActiveTool('zoomout');}">Zoom Out</div> <div data-dojo-type="dijit.form.Button" id="zoomfullext" data-dojo-props="iconClass:'zoomfullextIcon', onClick:function(){zoomToFullExtent();}">Full Extent</div> <div data-dojo-type="dijit.form.Button" id="zoomprev" data-dojo-props="iconClass:'zoomprevIcon', onClick:function(){navToolbar.zoomToPrevExtent();}">Prev Extent</div> <div data-dojo-type="dijit.form.Button" id="zoomnext" data-dojo-props="iconClass:'zoomnextIcon', onClick:function(){navToolbar.zoomToNextExtent();}">Next Extent</div> <div data-dojo-type="dijit.form.Button" id="pan" data-dojo-props="iconClass:'panIcon', onClick:function(){navToolbar.activate(esri.toolbars.Navigation.PAN); setActiveTool('pan');}">Pan</div> <div data-dojo-type="dijit.form.Button" id="measure" data-dojo-props="iconClass:'measureIcon', onClick:function(){setActiveTool('measure'); displayMeasure();}">Measure</div> <div data-dojo-type="dijit.form.DropDownButton" data-dojo-props="iconClass:'bookmarkIcon'"> <span>Bookmarks</span> <div data-dojo-type="dijit.TooltipDialog"> <div id="bookmarks"></div> </div> </div> <div id="print_button"></div> <div data-dojo-type="dijit.form.Button" id="help" data-dojo-props="iconClass:'helpIcon', onClick:function(){displayHelp();}">Help</div> </div>
var toolbar = new dijit.Toolbar({},"navToolbar"); // print dijit var printer = new esri.dijit.Print({ map: map, url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task" }, toolbar.domNode); printer.startup(); In HTML <div id="navToolbar"></div>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.