Question on using the Editing Tools

812
11
01-14-2013 07:47 AM
RobertWinterbottom
Occasional Contributor
Hey Everyone, I have a question about the editing tools.  In my application I am using the template picker as well as the editing toolbar, in particular the reshape and cut tool. I am wondering what the best way to prevent the attribute inspector from appearing without interfering with any other tools.  For example I used the dojo.connect(myEditableLayer,"onClick") and called dojo.stop(evt) to prevent the default behavior from the onClick and stop the attribute inspector from popping up which works, but when I go to use the reshape tool I can't start inside the feature's geometry. What would be the best way to prevent the attribute inspector from being available to my user's?
0 Kudos
11 Replies
KellyHutchins
Esri Frequent Contributor
Robert,

Can you provide a code sample that shows the problem? You mentioned using the Template Picker and Draw Toolbar but not the Attribute Inspector. If you aren't using that then the attributes shouldn't appear - here's a sample that shows this:

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/ed_feature_creation
0 Kudos
RobertWinterbottom
Occasional Contributor
Thanks for the response Kelly.  I was looking for a little more functionality than what is in that sample.  I am looking to add in the editing toolbar as well which I took a screenshot of.  I would like to use this toolbar but not the attribute inspector. The code I am using for this is as follows:
       var settings = {
        map: map,
        templatePicker: templatePicker,
        layerInfos: [{featureLayer: editableLayer}],
        toolbarVisible: true,
        showAttributesOnClick: false,
        createOptions: {
         polygonDrawTools:[esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON,esri.dijit.editing.Editor.CREATE_TOOL_AUTOCOMPLETE]
        },
        toolbarOptions: {
         reshapeVisible: true,
         cutVisible: true,
         selectVisible: false
        }
       };
       var params = {settings: settings};
       var myEditor = new esri.dijit.editing.Editor(params,"editingTools");
       
       myEditor.startup();


This seems to bring both the edit toolbar and the attribute inspector in, Is there a way to just get the edit toolbar?

Here is the screenshot of the edit toolbar I currently have and need to keep.
[ATTACH=CONFIG]20716[/ATTACH]

If you need me to post more code just let me know I can, There is a lot of code in the app and I did not want to post more than was necessary
0 Kudos
KellyHutchins
Esri Frequent Contributor
Ok now I see. You are using the Editor widget which includes all the editing capabilities (template picker, toolbar, attribute inspector, attachments etc). One approach to this would be to build up the sample I sent earlier to add the additional capabilities. To do so you'd have to add a toolbar with buttons and associate them with the editor toolbar. See the sample here for details:

http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/toolbar_edit

Another option that feels like a bit of a hack - but seems to work would be to hide the info window using css. To do this add the following to your app:


       .infowindow{
        visibility: hidden !important;
      }
0 Kudos
RobertWinterbottom
Occasional Contributor
Thanks again Kelly.  I will try that tomorrow morning to see if I can get it working.  However I did not see any options on the sample page or the api reference page about adding in the Reshape Tool or the Cut tool, do you know of any way I could maybe add those to the toolbar in the same way as the other options in that sample?
0 Kudos
RobertWinterbottom
Occasional Contributor
Update on this.  Thanks for pointing out that sample Kelly, it looks like I can get most of the behavior I will be needing from doing that with the exception of the reshape and cut tool.  If there is a way I can add those to the toolbar that would be great.

On a separate note, I have noticed from doing some more testing that I am getting an error with the editor widget and was noticing the same error in one of the samples located here:

  http://help.arcgis.com/en/webapi/javascript/arcgis/samples/ed_simpletoolbar/index.html

The error is  - TypeError: 'undefined' is not an object (evaluating 'this._activeTool._enabled') and points to Editor-all.js line 19

This happens when I select a template from the template picker, then select the drawing tool I wish to use via this select widget (see attached photo).  Then if I move the mouse to the map I lose the tooltip and cannot draw. Upon selecting the template picker again I see this error and cannot draw any items on the map.  Everything works fine until I try to change the drawing tool.
[ATTACH=CONFIG]20731[/ATTACH]
0 Kudos
KellyHutchins
Esri Frequent Contributor
Hi Robert,

The geometry service has cut and reshape operations so you can build a tool that calls the geometry service methods to perform the actions.

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/#geometryservice

Thanks for the details about the error you are getting with the Editor. I'll take a look this morning and see if I can reproduce.

Kelly
0 Kudos
RobertWinterbottom
Occasional Contributor
Thanks for pointing that out Kelly, I will give it a shot.
0 Kudos
RobertWinterbottom
Occasional Contributor
Hey Kelly, I was curious if you were able to recreate that bug I had mentioned or if it seems like I may be doing something wrong on my end?
I had a meeting with my project manager the other day and it seems they really like the editor widget and would prefer I use that than building my own reshape and cut tool and connecting them to the geometry service. I was able to build a workaround for now by hiding the select box that was causing the error and placing a few buttons(one for each option that was in my select) in the toolbar that when clicked, will force the drawToolbar to activate a different drawing tool. This works for now but seems like kind of a hack.
0 Kudos
KellyHutchins
Esri Frequent Contributor
Yes I was able to reproduce the problem and it is a bug in the JSAPI that we'll get fixed for the next release.

Kelly


Hey Kelly, I was curious if you were able to recreate that bug I had mentioned or if it seems like I may be doing something wrong on my end?
I had a meeting with my project manager the other day and it seems they really like the editor widget and would prefer I use that than building my own reshape and cut tool and connecting them to the geometry service. I was able to build a workaround for now by hiding the select box that was causing the error and placing a few buttons(one for each option that was in my select) in the toolbar that when clicked, will force the drawToolbar to activate a different drawing tool. This works for now but seems like kind of a hack.
0 Kudos