dojo+arcgisjava script 4.12

824
3
08-17-2019 10:18 AM
anjelinaponkerat
Occasional Contributor II

Hi

I have some require and function that can not load in arcgisjavascript 4.12:

"dojo/dom",

"dojo/on", "dojo/dom-construct",

"dojo/_base/Color",

"dojo/query",

"dojo/dom",
"dojo/on",

"dojo/dom-construct",

"dojo/domReady!",

why?

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Can you post more of your code? It is strange that you have several modules listed twice.

0 Kudos
anjelinaponkerat
Occasional Contributor II

That was my mistake in writing the above question. 


require([
"esri/identity/OAuthInfo",
"esri/identity/IdentityManager",
"esri/WebScene",
"esri/Map",
"esri/tasks/Locator",
"esri/widgets/ScaleBar",
"esri/widgets/Slider",
"esri/widgets/Search/SearchSource",
"esri/renderers/SimpleRenderer",
"esri/symbols/FillSymbol3DLayer",
"esri/config",
"esri/views/MapView",
"esri/views/SceneView",
"esri/Camera",
"esri/layers/WMSLayer",
"esri/layers/TileLayer",
"esri/layers/BingMapsLayer",
"esri/layers/ElevationLayer",
"esri/layers/BaseElevationLayer",
"esri/widgets/Search",
"esri/geometry/Point",
"esri/geometry/Polyline",
"esri/geometry/Polygon",
"esri/tasks/Geoprocessor",
"esri/tasks/support/LinearUnit",
"esri/tasks/support/FeatureSet",
"esri/request",
"esri/layers/SceneLayer",
"esri/widgets/Home",
"esri/widgets/DirectLineMeasurement3D",
"esri/widgets/AreaMeasurement3D",
"dojo/query",
"esri/layers/GraphicsLayer",
"esri/Graphic",
"esri/symbols/MeshSymbol3D",
"esri/layers/MapImageLayer",
"esri/widgets/LayerList",
"esri/geometry/geometryEngine",
"esri/widgets/Legend",
"esri/symbols/Font",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/PolygonSymbol3D",
"esri/symbols/TextSymbol",
"esri/layers/OpenStreetMapLayer",
"esri/widgets/Sketch/SketchViewModel",
"esri/layers/Layer",
"esri/widgets/Expand",
"esri/geometry/Extent",
"esri/Viewpoint",
"esri/core/watchUtils",

"esri/core/urlUtils",
"esri/tasks/support/DataFile",
"dojo/dom",
"dojo/on",
"dojo/dom-construct",
"esri/layers/FeatureLayer",
"esri/symbols/PictureMarkerSymbol",
"esri/renderers/support/jsonUtils",
"esri/renderers/UniqueValueRenderer",
"dojo/_base/Color",
"esri/tasks/support/Query",
"esri/tasks/QueryTask",
"esri/symbols/PathSymbol3DLayer",
"esri/symbols/LineSymbol3D",
"esri/symbols/LineSymbol3DLayer",
"esri/widgets/CoordinateConversion",
"esri/widgets/CoordinateConversion/support/Format",
"esri/widgets/CoordinateConversion/support/Conversion",
"esri/geometry/support/webMercatorUtils",
"esri/geometry/SpatialReference",
"esri/widgets/Sketch/SketchViewModel",
"esri/widgets/Track",
"dojo/domReady!",
],
function(


OAuthInfo, esriId, WebScene, Map, Locator, ScaleBar, Slider, SearchSource, SimpleRenderer, FillSymbol3DLayer, esriConfig, MapView, SceneView, Camera, WMSLayer, TileLayer, BingMapsLayer, ElevationLayer, BaseElevationLayer, Search, Point, Polyline, Polygon, Geoprocessor, LinearUnit, FeatureSet, esriRequest, SceneLayer, Home, DirectLineMeasurement3D, AreaMeasurement3D, query, GraphicsLayer, Graphic, MeshSymbol3D, MapImageLayer, LayerList, geometryEngine, Legend, Font, SimpleLineSymbol, PolygonSymbol3D,TextSymbol, OpenStreetMapLayer ,SketchViewModel, Layer, Expand, Extent, Viewpoint, watchUtils, urlUtils, DataFile, dom, on, domConstruct, FeatureLayer,PictureMarkerSymbol, rendererJsonUtils, UniqueValueRenderer, Color,Query, QueryTask, PathSymbol3DLayer, LineSymbol3D, LineSymbol3DLayer, CoordinateConversion, Format, Conversion,
webMercatorUtils, SpatialReference, SketchViewModel,Track
)

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Anjelina,

  OK, I see what you are thinking. Just because the module does not look like it is loaded it actually is and here is code that proves it. I took your exact require and added it to a esri sample and when you click on the view you will see that dom, on, and domConstruct are all operating normally:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1,maximum-scale=1,user-scalable=no"
    />
    <title>Intro to MapImageLayer - 4.12</title>

    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.12/esri/themes/light/main.css"
    />
    <script src="https://js.arcgis.com/4.12/"></script>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <script>
      require([
        "esri/identity/OAuthInfo",
        "esri/identity/IdentityManager",
        "esri/WebScene",
        "esri/Map",
        "esri/tasks/Locator",
        "esri/widgets/ScaleBar",
        "esri/widgets/Slider",
        "esri/widgets/Search/SearchSource",
        "esri/renderers/SimpleRenderer",
        "esri/symbols/FillSymbol3DLayer",
        "esri/config",
        "esri/views/MapView",
        "esri/views/SceneView",
        "esri/Camera",
        "esri/layers/WMSLayer",
        "esri/layers/TileLayer",
        "esri/layers/BingMapsLayer",
        "esri/layers/ElevationLayer",
        "esri/layers/BaseElevationLayer",
        "esri/widgets/Search",
        "esri/geometry/Point",
        "esri/geometry/Polyline",
        "esri/geometry/Polygon",
        "esri/tasks/Geoprocessor",
        "esri/tasks/support/LinearUnit",
        "esri/tasks/support/FeatureSet",
        "esri/request",
        "esri/layers/SceneLayer",
        "esri/widgets/Home",
        "esri/widgets/DirectLineMeasurement3D",
        "esri/widgets/AreaMeasurement3D",
        "dojo/query",
        "esri/layers/GraphicsLayer",
        "esri/Graphic",
        "esri/symbols/MeshSymbol3D",
        "esri/layers/MapImageLayer",
        "esri/widgets/LayerList",
        "esri/geometry/geometryEngine",
        "esri/widgets/Legend",
        "esri/symbols/Font",
        "esri/symbols/SimpleLineSymbol",
        "esri/symbols/PolygonSymbol3D",
        "esri/symbols/TextSymbol",
        "esri/layers/OpenStreetMapLayer",
        "esri/widgets/Sketch/SketchViewModel",
        "esri/layers/Layer",
        "esri/widgets/Expand",
        "esri/geometry/Extent",
        "esri/Viewpoint",
        "esri/core/watchUtils",
        "esri/core/urlUtils",
        "esri/tasks/support/DataFile",
        "dojo/dom",
        "dojo/on",
        "dojo/dom-construct",
        "esri/layers/FeatureLayer",
        "esri/symbols/PictureMarkerSymbol",
        "esri/renderers/support/jsonUtils",
        "esri/renderers/UniqueValueRenderer",
        "dojo/_base/Color",
        "esri/tasks/support/Query",
        "esri/tasks/QueryTask",
        "esri/symbols/PathSymbol3DLayer",
        "esri/symbols/LineSymbol3D",
        "esri/symbols/LineSymbol3DLayer",
        "esri/widgets/CoordinateConversion",
        "esri/widgets/CoordinateConversion/support/Format",
        "esri/widgets/CoordinateConversion/support/Conversion",
        "esri/geometry/support/webMercatorUtils",
        "esri/geometry/SpatialReference",
        "esri/widgets/Sketch/SketchViewModel",
        "esri/widgets/Track",
        "dojo/domReady!",
        ],
        function(
          OAuthInfo, esriId, WebScene, Map, Locator, ScaleBar, Slider, SearchSource, SimpleRenderer, FillSymbol3DLayer, esriConfig, MapView, SceneView, Camera, WMSLayer, TileLayer, BingMapsLayer, ElevationLayer, BaseElevationLayer, Search, Point, Polyline, Polygon, Geoprocessor, LinearUnit, FeatureSet, esriRequest, SceneLayer, Home, DirectLineMeasurement3D, AreaMeasurement3D, query, GraphicsLayer, Graphic, MeshSymbol3D, MapImageLayer, LayerList, geometryEngine, Legend, Font, SimpleLineSymbol, PolygonSymbol3D,TextSymbol, OpenStreetMapLayer ,SketchViewModel, Layer, Expand, Extent, Viewpoint, watchUtils, urlUtils, DataFile, dom, on, domConstruct, FeatureLayer,PictureMarkerSymbol, rendererJsonUtils, UniqueValueRenderer, Color, Query, QueryTask, PathSymbol3DLayer, LineSymbol3D, LineSymbol3DLayer, CoordinateConversion, Format, Conversion,
        webMercatorUtils, SpatialReference, SketchViewModel, Track
        ) {
        /*****************************************************************
         * Create a MapImageLayer instance pointing to a Map Service
         * containing data about pool permits in Southern California.
         *****************************************************************/
        var permitsLayer = new MapImageLayer({
          portalItem: {
            // autocasts as new PortalItem()
            id: "d7892b3c13b44391992ecd42bfa92d01"
          }
        });

        /*****************************************************************
         * Add the layer to a map
         *****************************************************************/
        var map = new Map({
          basemap: "dark-gray",
          layers: [permitsLayer]
        });

        var view = new SceneView({
          container: "viewDiv",
          map: map
        });

        /*****************************************************************
         * Animate to the layer's full extent when the layer loads.
         *****************************************************************/
        permitsLayer.when(function() {
          view.goTo(permitsLayer.fullExtent);
        });
        
        console.log(dom.byId("viewDiv"));
        on(view, 'click', function(){
          console.log("view was clicked");
          var newDiv = domConstruct.toDom("<div>I'm a Node</div>");
          domConstruct.place(newDiv, dom.byId("viewDiv"))
        });
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>