targeting attribute inspector of editor

3112
10
01-06-2011 10:11 AM
timgogl
New Contributor II
i need to interact with the attribute inspector as it's various events happen.
i have on my page a defined editor, and template picker, the template picker is associated with the editor in the params used to create the editor. here is the code:

  function addEditor(r){
   
   var contentHolder = "<div id='editorDiv'></div><div id='tmpDiv'></div>";
   $j('##editDiv').append(contentHolder);
   
   var templateLayers = dojo.map(r,function(result){
    return result.layer;
   });
   
   var widget = new esri.dijit.editing.TemplatePicker({
    featureLayers: templateLayers,
    grouping: true,
    rows: 'auto',
    columns: 3
   },'tmpDiv');
   widget.startup();
   
   var layers = dojo.map(r, function(result) {
    return {featureLayer:result.layer};
   });
   
   var settings = {
    map: map,
    templatePicker: widget,//   <------- templatePicker for editor ----->
    geometryService: new esri.tasks.GeometryService(GEOSERVICE),
    layerInfos:layers,
    toolbarVisible: true,
    createOptions: {
     polylineDrawTools:[ esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYLINE],
     polygonDrawTools: [ esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON,
                         esri.dijit.editing.Editor.CREATE_TOOL_CIRCLE,
                         esri.dijit.editing.Editor.CREATE_TOOL_TRIANGLE,
                         esri.dijit.editing.Editor.CREATE_TOOL_RECTANGLE ]
    },
    toolbarOptions: {
     reshapeVisible: true
    }
   };
   var params = {settings: settings};   
   
   myEditor = new esri.dijit.editing.Editor(params,'editorDiv');
   myEditor.startup();  
   
  }



so, via settings / params, i have associated which templatePicker the editor is using.

is there a way i can do the same thing with the attribute inspector? or do i need to worry about that? can i just create an attribute inspector, and make connections to the eventhandlers for it, and the editor will automatically know whats going on?

heh. i dont know if that even makes sense.


hrm...

just to be more clear. or give a better picture of one of the things i want to do.

when i user drags on object from the template picker and drops it on the map, the attribute inspector opens in an info window. i want to populate the 'creator' field in the attribute inspector with the user information i have captured when the map is loaded.

if an already existing object from the feature layer is selected, and the user changes an attribute in the inspector, i want to populate the 'editor' field and the 'editdate' field

i dont think doing this will be that hard, i am just not sure how to target the attribute editor inside the currently defined editor.

heh. hope that is more clear.
0 Kudos
10 Replies
TheKenerson
Occasional Contributor

I was playing with this a bit again. Its kinda funny. I can make a new editor and I can make an attribute inspector but I cant make them work together. Once I run the editor.startup() it overrides my attribute inspector. Should the attribute editor be tied to the editor settings? Mine is not and I feel like it should.

Currently I have the attribute inspector and editor both using layerInfos to get their display information but other than that they are independent. I'm thinking this shouldn't be the case. Can someone please clarify this for me?

I am more than happy to share code.

0 Kudos