Hot answers tagged

10

I would agree with Moyles that the samples are just samples and dojo boileplate is a great resource however at current snovers boilerplate isn't a viable solution. You have two different versions of dojo going on there. The current js api still uses the classic require syntax of dojo 1.6.1 and does not support AMD. I'm sure that a newer js api will be built ...


9

They are functionally equivalent. The difference is that require() loads modules using AMD while your second example uses a class from a global variable populated by Dojo's module loader in legacy mode. Technically, you should have to use dojo.require("esri.geomtry.Point") for your second example to work but because the module that defines that class is ...


7

Since esri does not ship source code you cannot build one layer package with all your classes. You will have to push out the esri api locally or using the CDN and then pull down your layer file. So you will have 2 and then the extra's that esri forgot to bundle or chose not to. We've put together a discard layer so that you don't duplicate packages within ...


7

In instances like this, the API returns deferred objects in case you're interested in identifying when more than one request to a server has resolved, but its not something your application logic has to worry about if you're just dealing with one task at a time. for example, when you call QueryTask.execute() and leverage the in-built callback, you can get a ...


6

This blog has an excellent example of how to make the window draggable and hide the arrow using dojo: https://gavinr.com/2015/04/13/arcgis-javascript-draggable-infowindow Here's the key javascript snippet: require([ 'esri/arcgis/utils', 'dojo/dnd/Moveable', 'dojo/query', 'dojo/on', 'dojo/dom-class' ], function ( arcgisUtils, ...


6

This question is a year old but this alternate solution may be helpful to others. If you are using the Popup class you can set the Popup to a global variable so that you can set it not to show the window while updating. To prevent getting the "No information available" window, just set visibleWhenEmpty to false and hideDelay to 0: var popup = new Popup(...)...


5

Add the legend on map load, the onLayersAddResult is firing multiple times which means it is trying to create more than one legend of the same name. Connect to the onLoad event dojo.connect(map, 'onLoad', function (results) {


5

You're pretty close. The only reason it's not working is because you need to wrap your layerVisibility function call in an anonymous function. When you type this: dojo.connect(dijit.byId('imagery'), 'onChange', layerVisibility(mapLayers[0])); ..you're actually calling layerVisibility function immediately rather than having the function call triggered by ...


5

Using this sample... http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/widget_print_esri_request.html Instead of calling the request for printInfo and then handlePrintInfo on startup. Create some entry areas in your html where a user can enter values and a submit button. Setup an event handler for the onclick event of button. After the onclick,...


5

Include the dojo/parser and dojo/domReady! modules. Just like in this example https://developers.arcgis.com/javascript/jssamples/widget_basemap.html domReady will ensure that your DOM is loaded, the parser will set the ContentPane height explicitly, so the map will have the ContentPane height it needs to know before initializing. Your code will look like ...


4

That's the markup generated by dojo for a specific kind of widget (dijit). You wouldn't actually build that yourself– it's the result of creating a dijit (either declaratively or programmatically). There are a number of button-style dijits available: http://dojotoolkit.org/reference-guide/dijit/form/Button.html http://dojotoolkit.org/reference-guide/dijit/...


4

Well, there are a bunch of things wrong with this. 1) You're firing "dojo.connect('true')" whenever the checkbox is checked, which does nothing. The first argument to dojo.connect should be an object and the second argument should be the name of an event to listen for. Given the fact that you've defined a "clickConnect" event anyway, it seems like you ...


4

I would personally create the chart myself rather than trying to use the ESRI popup class and then add it to a simple info window. Here is a link to a fiddle which gives the basic idea. I'd based upon ESRI's sample that you sited. I haven't shown how to populate your own data in to the series, it just uses mock data. Let me know if you are not sure how to ...


4

The answer I was looking for was provided here! https://community.esri.com/message/342922?commentID=342922#comment-342922 Cheers


4

When defining the columns for your grid, you can specify a formatting function to transform the value from the data store to something else. To do this, you need to modify your column definition and also define the function that will turn your URL into a link. Here's the relevant code: grid = new OnDemandGrid({ store: Memory({ idProperty: "...


4

definitely a scope problem. check out this sample which includes an example of wiring up a Dijit event listener within a require callback in JS instead of declarative HTML. registry.byId("numLocations").on("change", function() { params.defaultTargetFacilityCount = this.value; clearGraphics(); });


4

The array of module IDs passed to require includes "dijit/form/Button" but there's no alias for it in the callback. Add Button, between Color, and on, in the arguments for your function that's passed to require and dom will exist and have the byId method you're trying to use.


4

it is possible read this document for example : firstly set dojo config dojoConfig = { parseOnLoad: false, packages: [{ "name": "customWidget", "location": "/customWidget" }] }; /customWidget/customModule.js define([ "dijit/_WidgetBase", "dijit/_OnDijitClickMixin", "dijit/...


3

You are not adding a layer to the map which is why you only see the logo and a white map. Try for example adding the world street map: var map = new esri.Map("mapDiv"); var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"); map.addLayer(...


3

Add a div with id identifyDiv to your html code and change you javascript to be var popup = new esri.dijit.Popup({popupOptions}, "identifyDiv"); map = new esri.Map("map", { infoWindow:popup, extent: initExtent }); makeMoveable("identifyDiv");


3

Okay, since you're using the using the ComboBox, I'm reworking my answer so that it fits your question. Since you need to sort your data, we're going to modify the oncomplete command to load the sorted data into the menuStore, then create your combobox. var dataItems = { identifier: 'name', label: 'name', items: values }; var menuStore = new ...


3

I would argue that the JSAPI already provides equivalent functionality to what's in GeoExt. All of the additional widgets provided by dojo are just a require statement away. It's up to you how you use them. Here's an example of a JSAPI site that has always struck me as having a "GeoExt feel": http://uplan.utah.gov/ For your specific case of a tooltip on ...


3

Here's a working example that geocodes and address/place and then buffers the first result: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <...


3

It should be pretty obvious that samples aren't meant to be serious applications: they're samples. That said, it's much less common, in the typical internet world, to use something like Backbone than to use dojo, which is known for being expansive and complex, but often unnecessary. If you could describe your objective more, it'd be easier to make a solid ...


3

Have you looked at this sample of using jquery with arcgis javascript api? It says "When building applications with frameworks other than Dojo, you still need to use dojo to connect to map events. In this snippet, we connect to the map's onLoad event and then call .ready().The .ready() method is automatically called when the DOM is fully loaded." dojo....


3

Look at this post for a good example JS API Toggle Pop-Up On & Off. When you add connect to the onclick event to the map or featurelayer etc, you need to save the reference to the clickHandle. Then when a workflow is started where you don't want popups on, you disconnect and then re-connect when finished. //instead of this -- don't do this dojo.connect(...


3

you must be having map div.put following code <div id="map"> <input id="Addlyr" type="submit" value = "Add Layer" style="position: absolute; z-index: 1000; left: 100px; float: right;" /> </div> if you want new button and put nice style adjust using css in style attribute of input button. If you are referring + and - button then ...


3

If using MODE_ONDEMAND with autoGeneralize:true, then you should remove maxAllowableOffset and let the api set the default based on map resolution. But also, if you only have 220 features, try using MODE_SNAPSHOT instead of MODE_ONDEMAND. Initial load will be slower, but your overall performance should probably be better. Adding code samples as an edit: ...


3

I hate to answer my own question, but I've found a resolution. ESRI is releasing their JavaScript Web Optimizer, which will bundle and optimize everything into one file. That includes custom classes, Dojo itself, and only the required JavaScript API modules. I saw it at the Dev Summit, and it's pretty interesting.


3

I really appreciate all the suggestions, but I never got the esri/dijit/Popup to be moveable and still be able to highlight and copy the text inside. Instead I used a jQuery Dialog, which I figured would be the case but it just took a while to get all the experience needed to make it work the way I wanted it to. My boss and I both worked on it and we still ...


Only top voted, non community-wiki answers of a minimum length are eligible