Hot answers tagged

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 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(...)...


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, ...


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

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

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

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

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

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

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

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

OpenLayers is not built on ExtJS in the same way ArcGIS Javascript API is built on top of dojo. I would instead compare GeoExt with dojox.geo.openlayers. If your question is which framework is better I can say that dojo documentation has vastly improved thanks to SitePen and that dojo provides the tools to create MVC instead of an actual MVC architecture ...


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'm not sure why .disableMouseEvents() stopped working after 3.9, but you can use map.setInfoWindowOnClick() instead. here's a working sample.


3

Change popup.on("selection-change", function(){ to popup.on("set-features", function(){


3

Try calling map.resize() after the ContentPane is rendered and the map div resized. You may also have to use map.reposition() depending on if the div was moved or not. Edit, in response to your comment about making sure it goes after the ContentPane reposition: Putting it after window.onload will make sure that it fires after everything else has completely ...


3

you don't necessarily need a dropdown. any button will do. you just need to work on ensuring that clicking the button alters the .css appropriately. this is a mostly completely unrelated code sample, but check out the live demo below to see an example where clicking a feature in the map makes an unrelated <div> visible by removing a CSS class. code:...


3

It looks like the problem is that the spatial reference of this map is not the standard Web Mercator, but is 4269. You'll notice if you go to the REST service, it will show up when you click on the ArcGIS JavaScript link, but not the ArcGIS.com link (using a Web Mercator basemap)


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