Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 at 7:25
    
no problem @Taha Rehman Siddiqui. i'm happy to help. –  John Gravois Jan 22 at 4:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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