AnsweredAssumed Answered

Does editor widget support create feature only?

Question asked by stephenlam1988 on Oct 9, 2014

I successfully use "Editor widget with simple toolbar" to create a polygon, which let me create feature, editing existing features' attribute and deleting the features. However, I would like to only allow the editor to create feature and edit it, which means editor is not allowed to edit existing or deleting features. Can I achieve this? I have modified some code but it returns me an error:

 

TypeError {stack: (...), message: "Cannot read property '_init' of undefined"} "TypeError: Cannot read property '_init' of undefined

    at S._editHandler (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/js/esri/layers/FeatureLayer.js:81:21)

    at Object.E.load (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/js/esri/layers/FeatureLayer.js:43:66)

    at http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:635:478

    at c (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:79:221)

    at d (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:79:10)

    at resolve.callback (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:80:350)

    at c (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:79:436)

    at d (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:79:10)

    at resolve.callback (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:80:350)

    at c (http://localhost:55918/Scripts/arcgis_js_api/library/3.10/3.10/init.js:79:436)"

 

Refering to this sandbox, the code is changed as below:

 

        var waterbodies = new FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/0",{

          mode: FeatureLayer.SELECTION_NEW,

          outFields: ['*']

        });

Outcomes