In my code (using API version 4.18), I'm using a WebScene and WebMap (toggling between 2d and 3d is supported) with many layers. I'd like for users to be able to edit, but not add to, features in one particular feature layer. However, I can't seem to be able to disable the "Add feature" button using addEnabled. Here's my code:
window.locatesFeatureLayer = new this.FeatureLayer({
url:
"url to the feature layer in our portal"
});
editor = new this.Editor({
view: view,
container: editorContainer,
layerInfos: [{
layer: window.locatesFeatureLayer,
addEnabled: false
}]
});
editor.addEnabled = false; (//tried to set addEnabled here, too, but
no luck
Here's what the Editor widget looks like when I run my code (it's in an Expand widget, as you can see):
Even if I can disable "Add feature", that's not ideal, since the button is still visible in that case. What I'd really like is to hide or remove that button altogether.
My questions are,
Solved! Go to Solution.
Thanks for the feedback @BrentGrossman and sorry I missed the fact that you also tried to pass addEnabled in the layerInfos. It would be good to see a complete sample as that should work. I've just tried it on the Configurable Editor Widget sample and this is what it looks like:
Using addEnabled on the layerInfos
As @Kishore pointed out using allowedWorkflows directly on the Editor
@ArnoFiva, I was able to make "addEnabled: False" work on the Configurable Editor Widget sample, too, by putting it in both layers. My code gets many layers from the portal WebScene that it uses (most of which are not editable), so maybe that's the difference?
"allowedWorkflows" is a perfectly adequate solution for me, but I can probably provide more of my code, if you want to look at it to better understand why "addEnabled" didn't work for me, though I don't think I should post it here.