4.11 Can't Edit layer

150
2
Jump to solution
03-28-2019 09:09 PM
JeremyLuymes
New Contributor III

Any suggestions on why I can't edit a layer in 4.11? 

I used the basic code in the Editor widget sample, swapping out a layer from a published service. Below are the settings on ArcGIS server, seems like they should allow for editing. The map and layer loads but the editor widget does not display. Any idea why the Editor widget isn't showing up?

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Edit test</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css">
<link rel="stylesheet" href="css/mapstyle.css">
<script src="https://js.arcgis.com/4.11/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/widgets/Editor",
"esri/widgets/Search",
"esri/widgets/Home",
], function(Map, MapView, FeatureLayer,Editor,Search,Home) {

var map = new Map({
basemap: "gray-vector"
});

var view = new MapView({
container: "viewDiv",
map: map,
center: [-78.491,38.036],
zoom: 12,
padding:{
top:30
}
});


var poleLyr = new FeatureLayer({
url: "SERVERURL/CVPoles/MapServer/0",
title: "Poles",
visible: true
})

map.add(poleLyr)

var editor = new Editor({
view: view
});

view.ui.add(editor,"top-left");

var home = new Home({
view: view
});
view.ui.add(home,"top-left");

//add search
var search = new Search({
view: view,
locationEnabled: false,
maxSuggestions: 4,
popupOpenOnSelect: false,
container: "searchDiv"
});
});


</script>
</head>

<body>
<div id="viewDiv"></div>
<div id="editorDiv"></div>
<div id="searchDiv"></div>
</body>
</html>
Reply
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Jeremy,

   The url has to be FeatureServer Not MapServer:

var poleLyr = new FeatureLayer({
        url: "SERVERURL/CVPoles/FeatureServer/0",
        title: "Poles",
        visible: true
      })

View solution in original post

Reply
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Jeremy,

   The url has to be FeatureServer Not MapServer:

var poleLyr = new FeatureLayer({
        url: "SERVERURL/CVPoles/FeatureServer/0",
        title: "Poles",
        visible: true
      })

View solution in original post

Reply
0 Kudos
JeremyLuymes
New Contributor III

Thanks so much Robert, can't believe I didn't notice that! Everything is working now, appreciate the help.

Reply
0 Kudos