edit attributes for specific feature

2896
1
Jump to solution
04-05-2016 01:46 AM
behsoh
by
New Contributor II

Hi everyone

help me find a way to edit attributes of a featurelayer. but not using attributeInspector widget.

sofar I've set an edit button in Popup footer. users click on it and I want them to be able to edit attributes in another Div.

so I have the object of that specific element.

which looks like this:

  1. attributes:Object
    1. OBJECTID:"17"
    2. Shape:"Point"
    3. date:"Null"
    4. id:"Null"
    5. name:"some Thing"
    6. type:"some Type"
    7. __proto__:Object
  2. geometry:Object
    1. spatialReference:Object
    2. type:"point"
    3. x:5733576.450887503
    4. y:3865276.718386505
    5. __proto__:Object
  3. infoTemplate:Object
  4. symbol:null
  5. __proto__:Object

what can i do?

0 Kudos
1 Solution

Accepted Solutions
YousefQuran
Occasional Contributor

Hi beh soh​,

You can simply use the ApplyEdits method of the FeatureLayer.

Example.

var attr = {
  "ID": targetRefID,
  "SUBSECRIPTION_TYPE": 1,
  "COVERAGE_TYPE": COVERAGE_TYPE_VALUE,
  "X_COORD": customerPoint.x,
  "Y_COORD": customerPoint.y
  };
  var g_ = new Graphic(customerPoint, null, attr, null);
  customerLayer.applyEdits([g_], null, null, addCustomerResult, err);

If you find the answer, please mark it.

View solution in original post

1 Reply
YousefQuran
Occasional Contributor

Hi beh soh​,

You can simply use the ApplyEdits method of the FeatureLayer.

Example.

var attr = {
  "ID": targetRefID,
  "SUBSECRIPTION_TYPE": 1,
  "COVERAGE_TYPE": COVERAGE_TYPE_VALUE,
  "X_COORD": customerPoint.x,
  "Y_COORD": customerPoint.y
  };
  var g_ = new Graphic(customerPoint, null, attr, null);
  customerLayer.applyEdits([g_], null, null, addCustomerResult, err);

If you find the answer, please mark it.