Select to view content in your preferred language

How to Set a feature layer Editable? (without Editor widget)

1087
3
10-21-2013 08:49 AM
yufeizhuang
Emerging Contributor
Hi all, I'm new to arcgis JS api, now I want to update the whole records in a specific field of the feature layer, but I don't want to use the Editor Widget, is it possible? How to set the layer editable?
I did some research about using ApplyEdit() method, but still confuse about it.
Can anyone give me some hints or code examples? Thanks in advance!
0 Kudos
3 Replies
JasonZou
Frequent Contributor
You can define a onClick event handler for the feature layer for edit. Here is the code snippet. editTool is an esri/toolbars/edit type object that should be initialized somewhere.

var clickActions = esri.toolbars.Edit.MOVE | 
       esri.toolbars.Edit.ROTATE |
       esri.toolbars.Edit.SCALE | 
       esri.toolbars.Edit.EDIT_VERTICES;
featureLayer.on("click", function(evt) {
    dojo.stopEvent(evt);
    editTool.activate(clickActions, evt.graphic);
});


Here is the ESRI editing sample w/o using Editor widget.

Hope it helps.
0 Kudos
NumaGremling
Deactivated User
I hope this is related enough to post it here. Is it possible to use input fields and a Submit button to write to a table? See my screenshot below. Could I use that to let the user submit information to a table in my geodatabase (i.e. add a new row with all the information)?

Thank you.

[ATTACH=CONFIG]28494[/ATTACH]
0 Kudos
JohnGravois
Deactivated User
@numa.  definitely.  you just need to write the logic to map the input textboxes to graphic.attributes prior to calling featureLayer.applyEdits();

yufei's question is cross posted here
http://gis.stackexchange.com/questions/75012/how-to-set-a-feature-layer-editable-without-editor-widg...

(and here)
http://gis.stackexchange.com/questions/74286/arcgis-javascript-api-update-records-of-a-feature-layer
0 Kudos