var map, polyFeatLayer
function init() {
//... other code is in this function like the "onLayerAddResult" listener to initialize template picker/ editor widget, etc.
polyFeatLayer = new esri.layers.FeatureLayer("http://www......../FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ,
id: "polyFeatLayerId"
});
// note: currently I have not added corresponding ArcGISDynamicMapServiceLayer
dojo.connect(polyFeatLayer, "onEditsComplete", addResultsComplete);
dojo.connect(polyFeatLayer, "onSelectionComplete", selectionComplete);
}
function addResultsComplete(addResults) {
if (addResults.length > 0) {
alert("got Result"); //so far this works
var featLyr = map.getLayer("polyFeatLayerId");
var query = new esri.tasks.Query();
query.where = "OBJECTID = '" + addResults[0].objectId + "'";
featLyr.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
}
}
function selectionComplete(features) {
alert("count: " + features.length); // this is 0, unless I close the map.InfoWindow and manually (re)select a feature -- so this is my first problem area ... ???
if (features.length == 1) {
var currentDate = new Date();
var dateString = ((currentDate.getMonth() + 1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear());
var fixedDate = new Date.parse(dateString);
var polyDesc = document.forms[0].polyDescriptionInput.value;
var feature = features[0];
feature.attributes["DT_ADDED"] = fixedDate;
feature.attributes["POLY_DESC"] = polyDesc;
polyFeatLyr.applyEdits(null, [feature], null); //and this fails too!!! with a "TypeError: that._currentGraphic is undefined"
//
Solved! Go to Solution.
var map, polyFeatLayer
function init() {
//... other code is in this function like the "onLayerAddResult" listener to initialize template picker/ editor widget, etc.
polyFeatLayer = new esri.layers.FeatureLayer("http://www......../FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields:
var map, polyFeatLayer
function init() {
//... other code is in this function like the "onLayerAddResult" listener to initialize template picker/ editor widget, etc.
polyFeatLayer = new esri.layers.FeatureLayer("http://www......../FeatureServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields:do you have real working demo ? I trying a lot of difference examples no one doesn't work for me (
Thanks you so much. This worked for me !!