AnsweredAssumed Answered

Unable to work with the map object ( in javascript

Question asked by tjones on Aug 3, 2015
Latest reply on Aug 3, 2015 by PWong-esristaff

I have created a small query widget for ESRI's web app builder. However, I cannot get access the object. When inspected in Chrome, it appears I'm getting some other object in the map's place instead. What am I doing wrong here, and how do I obtain the object correctly?

The error occurs on the line where occurs and the error is: is not a function



Any attempt to work with results in a similar error. I have tried comparing my code against the pre-existing ESRI widgets in the web app builder and I am not seeing any differences that would lead to this error.




function(declare, lang, query, html, array, fx, all, Deferred, Map, Graphic, graphicsUtils, on,  BaseWidget, dom, Query, QueryTask,  FeatureLayer, MapManager,  Extent, Color, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol) { //a
  //To create a widget, you need to derive from BaseWidget.
  return declare([BaseWidget], { 
    // Custom widget code goes here
    baseClass: 'jimu-widget-nessearch',
    name: 'Search',
   startup: function() { 

   _onPointBtnClicked: function(){ //d
    //var layer
    var query = new Query();
    query.returnGeometry = true;
    switch (dom.byId("SelectType").selectedIndex) { //e
      case 0:
        var featurelayer = <Layer 0>);
        query.outFields = ["POLE_NO", "PNO"];
        query.where = "UPPER(POLE_NO) LIKE UPPER('%" + dom.byId("SearchValue").value + "%')";
        featurelayer.queryFeatures(query, function(result){  
        alert(; //returns an id of "map"
        //Problem Line:, true);  //fails here
        var markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1.5),        new Color([255, 0, 0, 0.5]));
        var polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2), new                   Color([255, 0, 0, 0.5]));