Select to view content in your preferred language

Hide Edit Features section of Editor Widget

1717
6
Jump to solution
05-04-2022 12:58 PM
JillianStanford
Frequent Contributor

Hi,

I'm using an Editor widget to allow users to add new features to a layer but they will not be able to update or delete existing features. To keep things simple, I'd like to remove the "Edit features" section of the widget and just display the "Create features" section.

 

JillianStanford_1-1651693745848.png

 

I've set the "allowedWorkflows" property to ["create-features"]

I have the widget configured with a single layerInfo object and it has updateEnabled and deletedEnabled set to false.

editBikeLayerConfig = {
 layer: layer,
 addEnabled: true,
 updateEnabled: false,
 deleteEnabled: false,
 formTemplate: {
  elements: [{
   type: "field",
   fieldName: "Name",
   label: "Name"
  }]
 }
};

const editor = new Editor({
 view: view,
 layerInfos: [editBikeLayerConfig],
 allowedWorkflows: ["create-features"],
 supportingWidgetDefaults: {
  featureTemplates: {
   visibleElements : {
    filter: false
   }
  }
 }
});

 

Is there a property that I can configure for this?

Thanks!

Jill

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

My bad...I didn't actually try using the widget after making that change.  It seems that in addition to what you have to hide the Select button, you could add the second selector shown below to get rid of the header as well:

.esri-editor__update-features-action-buttons {
	display: none;
}

div.esri-editor__scroller>div:first-child h5 {
	display: none;
}

 

I have actually tried going through the workflow with those, and it appears to work as expected.

View solution in original post

6 Replies
JoelBennett
MVP Regular Contributor

Somebody can correct me if I'm wrong, but the visibility of that section doesn't appear to be configurable.  Adding the following to the style tag of the "Edit features with the Editor widget" sample causes it to disappear though:

div.esri-editor__scroller>div:first-child {
	display: none;
}

Perhaps you can work that selector (or something similar to it) into your application.

JillianStanford
Frequent Contributor

It would be nice if it was configurable but your solutions works.

Thank you!

0 Kudos
JillianStanford
Frequent Contributor

Oops, I spoke too soon -
This solution doesn't work because once the widget switches to the attribute editor view the first child div is the FeatureForm widget and it becomes hidden.

I am no css wizard, I can get rid of the Select button but not the Edit feature header.

.esri-editor__update-features-action-buttons {
display: none;
}

JoelBennett
MVP Regular Contributor

My bad...I didn't actually try using the widget after making that change.  It seems that in addition to what you have to hide the Select button, you could add the second selector shown below to get rid of the header as well:

.esri-editor__update-features-action-buttons {
	display: none;
}

div.esri-editor__scroller>div:first-child h5 {
	display: none;
}

 

I have actually tried going through the workflow with those, and it appears to work as expected.

JillianStanford
Frequent Contributor

That seems to work and the FeatureForm remains visible!

This post seems to indicate that the allowedWorkflows parameter should control what tools are visible and I'd like to know what I'm doing wrong there but for now I'll use your solution.


Many thanks!

0 Kudos
cybryant
New Contributor

Thank you!!!!  I had been trying to figure this out too. I also expected the allowedWorkflows parameter to adjust this. It does in the opposite direction, when you set it to 'update' only, but not in for just adding.

0 Kudos