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!
Solved! Go to Solution.
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.
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.
Yes, ESRI also said it may be against the basic rules. Thank you very much!