Select to view content in your preferred language

Editor Dijit, how to move a point?

2621
12
Jump to solution
05-09-2014 11:27 AM
JeffPace
MVP Alum
Ok, this should be simple. Using an editor widget.  I can place and reshape polygons.  I can place points.  But how do i move a point?

http://developers.arcgis.com/javascript/samples/ed_editing_widget/

So place a point.  Then select it, then move it...how?

i must be missing something obvious
0 Kudos
1 Solution

Accepted Solutions
JeffPace
MVP Alum
so...

Don't add a layer as an editable feature layer after adding it (also) as a Dynamic Layer, it breaks the ability to move points.

View solution in original post

0 Kudos
12 Replies
SubaKrishnan
Esri Contributor
Hey Jeff,

There is a sample that uses edit toolbar, which is a helper tools and that would allow to move points features

https://developers.arcgis.com/javascript/jssamples/toolbar_edit.html

Thanks,
Suba
0 Kudos
JeffPace
MVP Alum
It works for a point with text, but not just a point

for example

https://developers.arcgis.com/javascript/jssamples/ed_feature_creation.html

1. add point.
2. Move point after added (impossible for me)

help 🙂
0 Kudos
JeffPace
MVP Alum
anyone? this is a huge stumbling block for us.
0 Kudos
BabbageOcelot
Deactivated User
Hi Jeff,

I don't think this is related to the symbol type... we did some work with editable FeatureLayers a while back, and found that the layer had to be fully refreshed before attempting to do anything else with a newly added feature. We were using the draw toolbar + TemplatePicker, not the Editor. So, in our (admittedly completely different) scenario, it went:

1. Apply edits
2. Refresh the layer
3. Use the ObjectID value from FeatureEditResult to query the [refreshed] dataset & select the new feature.

featureLayer.applyEdits([newGraphic], null, null, function (res) {
     
  // res is of type FeatureEditResult.
  // Need to query *again* to get the new object from its ID.
  // ORLY? YARLY.
     
  on.once(featureLayer, 'update-end', function(error, info){
      
    var query = new Query();
    query.objectIds = [res[0].objectId];

    featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (result) {
       
      // Your stuff here, or in the callback function.
       
      if (typeof(mycallbackfunction) == "function") {
        return mycallbackfunction(newGraphic);
      }
       
    });
      
  });
     
  // Fire the layer update.
  featureLayer.refresh();
     
});


That's butchered from a module elsewhere, so I doubt it'll "just work" for you... In fact, looking at it now, I'm amazed it hasn't fallen over already. But still, try refreshing the layer & see where you get to.
0 Kudos
JohnGravois
Deactivated User
@jeff,

after modifying the sample Suba provided to use a SimpleMarkerSymbol instead of a TextSymbol, i am able to select the existing point, see the cursor arrow become a hand, then drag the point to a new location.

http://jsfiddle.net/jagravois/TQgJG/
0 Kudos
JeffPace
MVP Alum
Sorry, mine is a point graphic from a Feature Layer.

I will try to stub up a fiddle, never done that before
0 Kudos
JeffPace
MVP Alum
Try it in this sample.

http://developers.arcgis.com/javascript/samples/ed_editing_widget/

But do not click to select.  Use the edit toolbar arrow tool to select.  We dont use popups, we use the attribute inspector in a separate div panel, so we have to use the tool to select.

If you click and select, you get the hand and can move the point
If you use the toolbar tool to select, you never get the hand.
0 Kudos
JohnGravois
Deactivated User
jeff,

thanks for the clarification.  maybe i'm missing something, but i'd argue that this makes the behavior of the select tool in the editor toolbar the same for points as other geometry types, not different. (ie: when you 'select' a polygon you can't drag the entire feature around or automatically edit individual verticies either)
0 Kudos
JeffPace
MVP Alum
Ok i understand that.  I tried a fiddle and moving points works.

So now I am baffled. In my app I never get the hand.

I click on a point and it selects.  But i never get the hand to move.
0 Kudos