AnsweredAssumed Answered

How to use a Renderer to override the symbology coming from the map service

Question asked by michel.turmelcgi on Oct 14, 2020
Latest reply on Oct 15, 2020 by michel.turmelcgi

I am in the process of creating my first custom 2 D widget and I can dynamically add a layer on the map , but as soon as I try to add a renderer to override the symbology coming from the map service then the layer does not show on the Layer List anymore and I get no error message


Here is my environment:

   - Portal for ArcGIS version 10.6

   - Web AppBuilder Developer Edition 2.6

   - ArcGIS JavaScript API 3.33


Here is part of my code: as soon as I had the lines in bold then the layer does not show anymore:


I have defined:




















  //To create a widget, you need to derive from BaseWidget.

  return declare([BaseWidget],



    baseClass: "test",


_onBtnTestClicked: function()


var comp1 = test1.value;


      var template = new esri.InfoTemplate();


      var comp1OperatorLayerURL = "https://........";

      var comp1OperatorfeatureLayer = new esri.layers.FeatureLayer(comp1OperatorLayerURL, {

        id: comp1Operator,

        outFields: ["*"],

        opacity: 0.5,

        infoTemplate: template,

        mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,

        definitionExpression: comp1OperatorSearch


      // set the symbology

      var symbol = new esri.symbol.SimpleFillSymbol().setColor(new esri.Color([255,0,0,0.5]));

      var renderer = new SimpleRenderer(symbol);