Editor Widget Problem

879
1
03-19-2013 09:56 AM
JustinAnderson
New Contributor
Hi Everybody,

Iâ??m using the Editor Widget at API version 3.3 ("esri.dijit.editing.Editor-all"). It seems to work well
for creating new features, but I've got a problem with editing previously created features.

My interface lets the user turn editing on, and then select
from a template picker, and add a feature as well as attributes. Then the user can
turn editing off.
However, once editing is turned off then back on (say to go back and update attributes), and you are back in Editing mode, any attempts to edit previously created features (from the first edit session) result in the following error (from jscript console) :
Uncaught TypeError: Cannot read property 'id' of null
The most recently edited feature also disappears for the remainder of the session (only a refresh of the website makes if visible again). I also get an empty Attribute editor pop (not input text boxes, etc).
If the user wants to add a new feature that functionality seems to work fine.


Here's my Editor code--

function createEditor() {
  
       
       if (editorWidget) {
         return;
       }
       if (editLayers.length > 0) {
         //create template picker 
         var templateLayers = dojo.map(editLayers, function (layer) {
           return layer.featureLayer;
         });

         var eDiv = dojo.create("div", {
           id: "editDiv"
         });
         dojo.byId('templatePickerPane').appendChild(eDiv);
         var editLayerInfo = editLayers;
         templatePicker = new esri.dijit.editing.TemplatePicker({
           featureLayers: templateLayers,
           rows: 'auto',
           columns: 'auto',
           style: 'height:98%;width:98%;'
         }, 'editDiv');
         templatePicker.startup();
         
         var settings = {
           map: map,
           templatePicker: templatePicker,
           layerInfos: editLayerInfo,
           toolbarVisible: false
         };
         var params = {
           settings: settings
         };
         
         editorWidget = new esri.dijit.editing.Editor(params);

         editorWidget.startup();
        
         
         var mybutton = document.getElementById("createEditor");
         mybutton.value = "Stop Editing"
         
         mybutton.onclick = destroyEditor;
         map.infoWindow.resize(300, 220);
         
       }  

     }
     
    
     
     function destroyEditor(){
     
        if (editorWidget) {
          
         editorWidget.destroy();
         editorWidget = null;
         var mybutton = document.getElementById("createEditor");
         mybutton.value = "Start Editing";
         mybutton.onclick =  createEditor;
       
       }
     
     }


If anybody has experienced a similar problem and can share their insight, I would be very thankful.

Cheers,
Justin
0 Kudos
1 Reply
DonWaldo
New Contributor II

Did you ever get a resolution for this?  3.19 seems to have the same type of issues with destroying and recreating the editor widget.

0 Kudos