Editor Widget issue when setting no attributes updatable - geometry only

849
3
Jump to solution
06-07-2021 07:21 AM
ChristopheS
New Contributor II

Hi All,

I have to modify features, but geometries only, attributes should not be shown nor updated.

So, as by default Editor fieldConfig is exposing all attributes, I tried to empty it with null, [] or [{}].

Unfortunately all these values are causing many issues and errors in the javascript console.

https://codepen.io/Chris_Siveco/pen/dyvKzNP

Is there a way to edit only geometries with the Editor widget ?

Regards

Chris

0 Kudos
1 Solution

Accepted Solutions
JeffreyWilkerson
Occasional Contributor III

How about leaving the fields in but not allowing them to be edited, such as:

 fieldConfigs: [{
     name: "HazardType",
     label: "Hazard Type",
     editable: false,
     direction: "asc"
},
{
    name: "descrip",
    label: "Description", 
    editable: false,
     direction: "asc"
},
{...

There is also a 'showNoValueOption' setting that might work (not much help on it).  Or maybe the 'visibilityExpression' that ties to an Arcade expression that is always false?

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.h... 

View solution in original post

0 Kudos
3 Replies
JeffreyWilkerson
Occasional Contributor III

How about leaving the fields in but not allowing them to be edited, such as:

 fieldConfigs: [{
     name: "HazardType",
     label: "Hazard Type",
     editable: false,
     direction: "asc"
},
{
    name: "descrip",
    label: "Description", 
    editable: false,
     direction: "asc"
},
{...

There is also a 'showNoValueOption' setting that might work (not much help on it).  Or maybe the 'visibilityExpression' that ties to an Arcade expression that is always false?

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.h... 

0 Kudos
ChristopheS
New Contributor II

Actually, with something like I made it work :

 const pointInfos = {
              layer: pointLayer,
              fieldConfig: [{
                name: "HazardType",
                label: "Hazard type",
                editable: false,
                visibilityExpression:"1==2" //Here is the Trick not to have any attributes editable nor shown !
              }]

 

BUT, after reviewing my codepen code, I also made it work with a regular fieldConfig: []

So, may be there was a bug in my original codepen.

Thank you Jeffrey

0 Kudos
JeffreyWilkerson
Occasional Contributor III

That second option looks a lot simpler 😁

0 Kudos