I am using this example to implement the editing on my map.

Editing Without Widget ARCGIS Javascript

The code employs a templatepicker which uses the layers on the map to show the features which can be selected and hence editing can be done on those features.

            templatePicker = new TemplatePicker({
                featureLayers: layers,
                rows: "auto",
                columns: 2,
                grouping: true,
                style: "height: auto; overflow: auto;"
            }, "templatePickerDiv");

However, you have to select a feature yourself before starting to edit it. After selection, the selected feature is fetched as

selectedTemplate = templatePicker.getSelected();

This selectedTemplate is then selected to put the points on the map.

selectedTemplate.featureLayer.applyEdits([newGraphic], null, null);

The problem is, I want to select the default or first feature in the templatePicker automatically as it loads. I tried finding if TemplatePicker has any method to select any feature but I couldnt. Is there any way that I could do that?


you don't need a programmatic hook into selecting a template immediately. just wire up logic to invoke the appropriate draw tool and pass edits to your hardcoded featureLayer of interest on draw-end immediately upon map load.

afterward, you can still listen for selection-change on TemplatePicker and direct the edits somewhere else.

  • Oh, it is that simple. I am very new to ARCGIS, in fact I started just a couple of weeks ago. Thanks for the help. I was able to resolve the issue with featureLayer.applyEdits([newGraphic], null, null); where featureLayer is the layer variable which has already been added to the map – Taha Rehman Siddiqui Jan 21 '15 at 7:25
  • no problem @Taha Rehman Siddiqui. i'm happy to help. – John Gravois Jan 22 '15 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.