About ESRI’ s drawing widget

1608
2
Jump to solution
05-05-2016 08:22 AM
LeiZhou1
Occasional Contributor

Once the drawing widget is open, even without doing anything, a layer will be added to the operational list in the Layer List widget. But I don’t want this layer to add if a user does nothing; I only want this result layer added when a user draws something in the widget. Can we adjust something here? I found a function that should control this, called  _pushAddOperation: function(graphics){ ….} in line 844 at the widget.js   But have no clue how to change it. Thanks!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Lei,

   That function _pushAddOperation has nothing to do with the layer getting added to the Layer list widget. You need to look at the _initLayers function. I have to say your not wanting the layers added until there are graphics added is very much against the norm. Almost all widget that I know of add layer to the map at startup. I guess you can call _initLayers when some graphic is being added and then add some logic to the function to say that it has been called already.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Lei,

   That function _pushAddOperation has nothing to do with the layer getting added to the Layer list widget. You need to look at the _initLayers function. I have to say your not wanting the layers added until there are graphics added is very much against the norm. Almost all widget that I know of add layer to the map at startup. I guess you can call _initLayers when some graphic is being added and then add some logic to the function to say that it has been called already.

LeiZhou1
Occasional Contributor

Yes, ESRI also said it may be against the basic rules. Thank you very much!

0 Kudos