FeatureLayer is not loading 4.19 and 4.20

08-03-2021 11:53 PM
New Contributor II


I'm trying to create FetureLayer using client-side graphics. here is my code;

 var layernew FeatureLayer({

          source: graphics,
          objectIdField: 'objectid',
          fields: [{ name: "objectid", type: "string" }],
          popupEnabled: true,
          popupTemplate: { content: "<div>Test Popup</div>" },
          renderer: {
            type: 'simple',
              type: "simple-fill",
            color: [ 51,51, 204, 0.9 ],
               style: "solid",
           outline: { color: "white", width: 1 }
          editingEnabled: false,

I can add layer to map but it is not show on map.I'm trying to run layer.load() function but function promise is definitely not resolved or reject.Featurelayer loadStatus property stay as 'loading'.
Is there anyone who can help me?
0 Kudos
4 Replies
New Contributor III

Are you rendering 2D polygons ? Or Points? 

Can you share a snippet of your graphics?

Is there any reason why typing ObjectID as a string and not type: "oid"

0 Kudos
New Contributor II

I'm rendering 2D polygons. I have no reason to type objectid as a string, i changed it to 'oid' but nothing changed, still not working. 

The code i shared works version 4.18 

I'll share  a snippet of my graphics.

0 Kudos
New Contributor II

here is sample code

Is there any problem with symbol? I really can't understand.

0 Kudos
Esri Regular Contributor

Hi there, 
Your codepen has an issue. You are directly assigning the symbol the layer's renderer. If you open the console you will see the error. Here is your codepen app updated. 

The changes are: 

const renderer = {
  type: "simple",
  symbol: symbol

var fl = new FeatureLayer({
   source: features,
   renderer: renderer, // change this from symbol to renderer


Hope this helps,


0 Kudos